2004-04-28 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / bfd / elf32-msp430.c
index 23f5069cb19b976bc3e00ac7b7ccd397bc648277..dfe33bd246fbf4fbad78a1c2bc21fb3a6cf51284 100644 (file)
@@ -1,5 +1,5 @@
 /*  MSP430-specific support for 32-bit ELF
-    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+    Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
     Contributed by Dmitry Diky <diwil@mail.ru>
 
     This file is part of BFD, the Binary File Descriptor library.
@@ -449,7 +449,7 @@ elf32_msp430_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          sym = local_syms + r_symndx;
          sec = local_sections[r_symndx];
-         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
 
          name = bfd_elf_string_from_elf_section
              (input_bfd, symtab_hdr->sh_link, sym->st_name);
@@ -457,33 +457,12 @@ elf32_msp430_relocate_section (output_bfd, info, input_bfd, input_section,
        }
       else
        {
-         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         bfd_boolean unresolved_reloc, warned;
 
-         while (h->root.type == bfd_link_hash_indirect
-                || h->root.type == bfd_link_hash_warning)
-           h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
-         name = h->root.root.string;
-
-         if (h->root.type == bfd_link_hash_defined
-             || h->root.type == bfd_link_hash_defweak)
-           {
-             sec = h->root.u.def.section;
-             relocation = (h->root.u.def.value
-                           + sec->output_section->vma + sec->output_offset);
-           }
-         else if (h->root.type == bfd_link_hash_undefweak)
-           {
-             relocation = 0;
-           }
-         else
-           {
-             if (!((*info->callbacks->undefined_symbol)
-                   (info, h->root.root.string, input_bfd,
-                    input_section, rel->r_offset, TRUE)))
-               return FALSE;
-             relocation = 0;
-           }
+         RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+                                  r_symndx, symtab_hdr, sym_hashes,
+                                  h, sec, relocation,
+                                  unresolved_reloc, warned);
        }
 
       r = msp430_final_link_relocate (howto, input_bfd, input_section,
@@ -550,10 +529,6 @@ bfd_elf_msp430_final_write_processing (abfd, linker)
   switch (bfd_get_mach (abfd))
     {
     default:
-    case bfd_mach_msp12:
-      val = E_MSP430_MACH_MSP430x12;
-      break;
-
     case bfd_mach_msp110:
       val = E_MSP430_MACH_MSP430x11x1;
       break;
@@ -562,6 +537,10 @@ bfd_elf_msp430_final_write_processing (abfd, linker)
       val = E_MSP430_MACH_MSP430x11;
       break;
 
+    case bfd_mach_msp12:
+      val = E_MSP430_MACH_MSP430x12;
+      break;
+
     case bfd_mach_msp13:
       val = E_MSP430_MACH_MSP430x13;
       break;
@@ -570,16 +549,12 @@ bfd_elf_msp430_final_write_processing (abfd, linker)
       val = E_MSP430_MACH_MSP430x14;
       break;
 
-    case bfd_mach_msp41:
-      val = E_MSP430_MACH_MSP430x41;
-      break;
-
-    case bfd_mach_msp43:
-      val = E_MSP430_MACH_MSP430x43;
+    case bfd_mach_msp15:
+      val = E_MSP430_MACH_MSP430x15;
       break;
 
-    case bfd_mach_msp44:
-      val = E_MSP430_MACH_MSP430x44;
+    case bfd_mach_msp16:
+      val = E_MSP430_MACH_MSP430x16;
       break;
 
     case bfd_mach_msp31:
@@ -594,12 +569,20 @@ bfd_elf_msp430_final_write_processing (abfd, linker)
       val = E_MSP430_MACH_MSP430x33;
       break;
 
-    case bfd_mach_msp15:
-      val = E_MSP430_MACH_MSP430x15;
+    case bfd_mach_msp41:
+      val = E_MSP430_MACH_MSP430x41;
       break;
 
-    case bfd_mach_msp16:
-      val = E_MSP430_MACH_MSP430x16;
+    case bfd_mach_msp42:
+      val = E_MSP430_MACH_MSP430x42;
+      break;
+
+    case bfd_mach_msp43:
+      val = E_MSP430_MACH_MSP430x43;
+      break;
+
+    case bfd_mach_msp44:
+      val = E_MSP430_MACH_MSP430x44;
       break;
     }
 
@@ -624,10 +607,6 @@ elf32_msp430_object_p (abfd)
       switch (e_mach)
        {
        default:
-       case E_MSP430_MACH_MSP430x12:
-         e_set = bfd_mach_msp12;
-         break;
-
        case E_MSP430_MACH_MSP430x11:
          e_set = bfd_mach_msp11;
          break;
@@ -636,6 +615,10 @@ elf32_msp430_object_p (abfd)
          e_set = bfd_mach_msp110;
          break;
 
+       case E_MSP430_MACH_MSP430x12:
+         e_set = bfd_mach_msp12;
+         break;
+
        case E_MSP430_MACH_MSP430x13:
          e_set = bfd_mach_msp13;
          break;
@@ -644,8 +627,12 @@ elf32_msp430_object_p (abfd)
          e_set = bfd_mach_msp14;
          break;
 
-       case E_MSP430_MACH_MSP430x41:
-         e_set = bfd_mach_msp41;
+       case E_MSP430_MACH_MSP430x15:
+         e_set = bfd_mach_msp15;
+         break;
+
+       case E_MSP430_MACH_MSP430x16:
+         e_set = bfd_mach_msp16;
          break;
 
        case E_MSP430_MACH_MSP430x31:
@@ -660,20 +647,20 @@ elf32_msp430_object_p (abfd)
          e_set = bfd_mach_msp33;
          break;
 
-       case E_MSP430_MACH_MSP430x43:
-         e_set = bfd_mach_msp43;
+       case E_MSP430_MACH_MSP430x41:
+         e_set = bfd_mach_msp41;
          break;
 
-       case E_MSP430_MACH_MSP430x44:
-         e_set = bfd_mach_msp44;
+       case E_MSP430_MACH_MSP430x42:
+         e_set = bfd_mach_msp42;
          break;
 
-       case E_MSP430_MACH_MSP430x15:
-         e_set = bfd_mach_msp15;
+       case E_MSP430_MACH_MSP430x43:
+         e_set = bfd_mach_msp43;
          break;
 
-       case E_MSP430_MACH_MSP430x16:
-         e_set = bfd_mach_msp16;
+       case E_MSP430_MACH_MSP430x44:
+         e_set = bfd_mach_msp44;
          break;
        }
     }
This page took 0.053447 seconds and 4 git commands to generate.