* config/tc-xtensa.h (resource_table): Change units to unsigned chars.
[deliverable/binutils-gdb.git] / bfd / elf32-mcore.c
index 59c5840d45ad1683c98fc3f25a764797407e8ef2..d1787485390839dd80ef110b2479ed73c3e165e4 100644 (file)
@@ -1,5 +1,5 @@
 /* Motorola MCore specific support for 32-bit ELF
 /* Motorola MCore specific support for 32-bit ELF
-   Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003
+   Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /* This file is based on a preliminary RCE ELF ABI.  The
    information may not match the final RCE ELF ABI.   */
 
 /* This file is based on a preliminary RCE ELF ABI.  The
    information may not match the final RCE ELF ABI.   */
@@ -84,7 +84,7 @@ static reloc_howto_type mcore_elf_howto_raw[] =
         0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
         bfd_elf_generic_reloc, /* special_function */
         0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
         bfd_elf_generic_reloc, /* special_function */
-        "ADDR32",              /* name *//* For compatability with coff/pe port.  */
+        "ADDR32",              /* name *//* For compatibility with coff/pe port.  */
         FALSE,                 /* partial_inplace */
         0x0,                   /* src_mask */
         0xffffffff,            /* dst_mask */
         FALSE,                 /* partial_inplace */
         0x0,                   /* src_mask */
         0xffffffff,            /* dst_mask */
@@ -350,8 +350,8 @@ mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
 {
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
 
 {
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
 
-  _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
-                     bfd_archive_filename (abfd),
+  _bfd_error_handler (_("%B: Relocation %s (%d) is not currently supported.\n"),
+                     abfd,
                      reloc_entry->howto->name,
                      reloc_entry->howto->type);
 
                      reloc_entry->howto->name,
                      reloc_entry->howto->type);
 
@@ -406,12 +406,12 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
   bfd_boolean ret = TRUE;
 
 #ifdef DEBUG
   bfd_boolean ret = TRUE;
 
 #ifdef DEBUG
-  fprintf (stderr,
-          "mcore_elf_relocate_section called for %s section %s, %ld relocations%s\n",
-          bfd_archive_filename (input_bfd),
-          bfd_section_name(input_bfd, input_section),
-          (long) input_section->reloc_count,
-          (info->relocatable) ? " (relocatable)" : "");
+  _bfd_error_handler
+    ("mcore_elf_relocate_section called for %B section %A, %ld relocations%s",
+     input_bfd,
+     input_section,
+     (long) input_section->reloc_count,
+     (info->relocatable) ? " (relocatable)" : "");
 #endif
 
   if (info->relocatable)
 #endif
 
   if (info->relocatable)
@@ -438,9 +438,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
       if ((unsigned) r_type >= (unsigned) R_MCORE_max
          || ! mcore_elf_howto_table [(int)r_type])
        {
       if ((unsigned) r_type >= (unsigned) R_MCORE_max
          || ! mcore_elf_howto_table [(int)r_type])
        {
-         _bfd_error_handler (_("%s: Unknown relocation type %d\n"),
-                             bfd_archive_filename (input_bfd),
-                             (int) r_type);
+         _bfd_error_handler (_("%B: Unknown relocation type %d\n"),
+                             input_bfd, (int) r_type);
 
          bfd_set_error (bfd_error_bad_value);
          ret = FALSE;
 
          bfd_set_error (bfd_error_bad_value);
          ret = FALSE;
@@ -453,8 +452,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
       /* Complain about known relocation that are not yet supported.  */
       if (howto->special_function == mcore_elf_unsupported_reloc)
        {
       /* Complain about known relocation that are not yet supported.  */
       if (howto->special_function == mcore_elf_unsupported_reloc)
        {
-         _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
-                             bfd_archive_filename (input_bfd),
+         _bfd_error_handler (_("%B: Relocation %s (%d) is not currently supported.\n"),
+                             input_bfd,
                              howto->name,
                              (int)r_type);
 
                              howto->name,
                              (int)r_type);
 
@@ -467,35 +466,17 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          sym = local_syms + r_symndx;
          sec = local_sections [r_symndx];
        {
          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);
          addend = rel->r_addend;
        }
       else
        {
          addend = rel->r_addend;
        }
       else
        {
-         h = sym_hashes [r_symndx - symtab_hdr->sh_info];
-         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->shared
-                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
-           relocation = 0;
-         else
-           {
-             if (! ((*info->callbacks->undefined_symbol)
-                       (info, h->root.root.string, input_bfd,
-                        input_section, rel->r_offset, TRUE)))
-               return FALSE;
+         bfd_boolean unresolved_reloc, warned;
 
 
-             ret = FALSE;
-             continue;
-           }
+         RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+                                  r_symndx, symtab_hdr, sym_hashes,
+                                  h, sec, relocation,
+                                  unresolved_reloc, warned);
        }
 
       switch (r_type)
        }
 
       switch (r_type)
@@ -539,7 +520,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                const char * name;
 
                if (h != NULL)
                const char * name;
 
                if (h != NULL)
-                 name = h->root.root.string;
+                 name = NULL;
                else
                  {
                    name = bfd_elf_string_from_elf_section
                else
                  {
                    name = bfd_elf_string_from_elf_section
@@ -553,8 +534,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  }
 
                (*info->callbacks->reloc_overflow)
                  }
 
                (*info->callbacks->reloc_overflow)
-                 (info, name, howto->name, (bfd_vma) 0, input_bfd, input_section,
-                  offset);
+                 (info, (h ? &h->root : NULL), name, howto->name,
+                  (bfd_vma) 0, input_bfd, input_section, offset);
              }
              break;
            }
              }
              break;
            }
@@ -665,14 +646,14 @@ mcore_elf_check_relocs (abfd, info, sec, relocs)
         /* This relocation describes the C++ object vtable hierarchy.
            Reconstruct it for later use during GC.  */
         case R_MCORE_GNU_VTINHERIT:
         /* This relocation describes the C++ object vtable hierarchy.
            Reconstruct it for later use during GC.  */
         case R_MCORE_GNU_VTINHERIT:
-          if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+          if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
             return FALSE;
           break;
 
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_MCORE_GNU_VTENTRY:
             return FALSE;
           break;
 
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_MCORE_GNU_VTENTRY:
-          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+          if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
             return FALSE;
           break;
         }
             return FALSE;
           break;
         }
@@ -681,13 +662,52 @@ mcore_elf_check_relocs (abfd, info, sec, relocs)
   return TRUE;
 }
 
   return TRUE;
 }
 
-static struct bfd_elf_special_section const mcore_elf_special_sections[]=
+static struct bfd_elf_special_section const
+  mcore_special_sections_c [] =
 {
   { ".ctors",   6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
 {
   { ".ctors",   6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+  { NULL,        0, 0, 0,            0 }
+};
+
+static struct bfd_elf_special_section const
+  mcore_special_sections_d[]=
+{
   { ".dtors",   6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
   { NULL,       0,  0, 0,            0 }
 };
 
   { ".dtors",   6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
   { NULL,       0,  0, 0,            0 }
 };
 
+static struct bfd_elf_special_section const *
+  mcore_elf_special_sections[27]=
+{
+  NULL,                                /* 'a' */
+  NULL,                                /* 'b' */
+  mcore_special_sections_c,    /* 'c' */
+  mcore_special_sections_d,    /* 'd' */
+  NULL,                                /* 'e' */
+  NULL,                                /* 'f' */
+  NULL,                                /* 'g' */
+  NULL,                                /* 'h' */
+  NULL,                                /* 'i' */
+  NULL,                                /* 'j' */
+  NULL,                                /* 'k' */
+  NULL,                                /* 'l' */
+  NULL,                                /* 'm' */
+  NULL,                                /* 'n' */
+  NULL,                                /* 'o' */
+  NULL,                                /* 'p' */
+  NULL,                                /* 'q' */
+  NULL,                                /* 'r' */
+  NULL,                                /* 's' */
+  NULL,                                /* 't' */
+  NULL,                                /* 'u' */
+  NULL,                                /* 'v' */
+  NULL,                                /* 'w' */
+  NULL,                                /* 'x' */
+  NULL,                                /* 'y' */
+  NULL,                                /* 'z' */
+  NULL                         /* other */
+};
+
 #define TARGET_BIG_SYM         bfd_elf32_mcore_big_vec
 #define TARGET_BIG_NAME                "elf32-mcore-big"
 #define TARGET_LITTLE_SYM       bfd_elf32_mcore_little_vec
 #define TARGET_BIG_SYM         bfd_elf32_mcore_big_vec
 #define TARGET_BIG_NAME                "elf32-mcore-big"
 #define TARGET_LITTLE_SYM       bfd_elf32_mcore_little_vec
This page took 0.027439 seconds and 4 git commands to generate.