* config/tc-xtensa.h (resource_table): Change units to unsigned chars.
[deliverable/binutils-gdb.git] / bfd / elf32-v850.c
index e4ca968e305fe63820af4c21f9bacd9253a4208d..98db745c54886adaa3efd302145f066c0ac78d83 100644 (file)
@@ -16,7 +16,7 @@
 
    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.  */
 
 /* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
    dependencies.  As is the gas & simulator code for the v850.  */
@@ -78,8 +78,6 @@ static bfd_boolean v850_elf_add_symbol_hook
 static bfd_boolean v850_elf_link_output_symbol_hook
   PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
           asection *, struct elf_link_hash_entry *));
-static bfd_boolean v850_elf_section_from_shdr
-  PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
 static bfd_boolean v850_elf_gc_sweep_hook
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
@@ -1651,15 +1649,6 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
 
-  if (sym_hashes == NULL)
-    {
-      info->callbacks->warning
-       (info, "no hash table available",
-        NULL, input_bfd, input_section, (bfd_vma) 0);
-
-      return FALSE;
-    }
-
   /* Reset the list of remembered HI16S relocs to empty.  */
   free_hi16s     = previous_hi16s;
   previous_hi16s = NULL;
@@ -1700,6 +1689,18 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          bfd_boolean unresolved_reloc, warned;
 
+         /* Note - this check is delayed until now as it is possible and valid
+            to have a file without any symbols but with relocs that can be
+            processed.  */
+         if (sym_hashes == NULL)
+           {
+             info->callbacks->warning
+               (info, "no hash table available",
+                NULL, input_bfd, input_section, (bfd_vma) 0);
+
+             return FALSE;
+           }
+
          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
                                   r_symndx, symtab_hdr, sym_hashes,
                                   h, sec, relocation,
@@ -2210,16 +2211,16 @@ v850_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
 }
 
 static bfd_boolean
-v850_elf_section_from_shdr (abfd, hdr, name)
-     bfd *abfd;
-     Elf_Internal_Shdr *hdr;
-     const char *name;
+v850_elf_section_from_shdr (bfd *abfd,
+                           Elf_Internal_Shdr *hdr,
+                           const char *name,
+                           int shindex)
 {
   /* There ought to be a place to keep ELF backend specific flags, but
      at the moment there isn't one.  We just keep track of the
      sections by their name, instead.  */
 
-  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+  if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
     return FALSE;
 
   switch (hdr->sh_type)
@@ -3123,35 +3124,92 @@ v850_elf_relax_section (abfd, sec, link_info, again)
   goto finish;
 }
 
-static struct bfd_elf_special_section const v850_elf_special_sections[]=
+static struct bfd_elf_special_section const
+  v850_special_sections_c[]=
+{
+  { ".call_table_data", 16,  0, SHT_PROGBITS,     (SHF_ALLOC
+                                                   + SHF_WRITE) },
+  { ".call_table_text", 16,  0, SHT_PROGBITS,     (SHF_ALLOC + SHF_WRITE
+                                                   + SHF_EXECINSTR) },
+  { NULL,        0, 0, 0,            0 }
+};
+
+static struct bfd_elf_special_section const
+  v850_special_sections_r[]=
 {
-  { ".sdata",            6, -2, SHT_PROGBITS,     (SHF_ALLOC + SHF_WRITE
-                                                   + SHF_V850_GPREL) },
   { ".rosdata",          8, -2, SHT_PROGBITS,     (SHF_ALLOC
                                                    + SHF_V850_GPREL) },
+  { ".rozdata",          8, -2, SHT_PROGBITS,     (SHF_ALLOC
+                                                   + SHF_V850_R0REL) },
+  { NULL,        0, 0, 0,            0 }
+};
+
+static struct bfd_elf_special_section const
+  v850_special_sections_s[]=
+{
+  { ".sdata",            6, -2, SHT_PROGBITS,     (SHF_ALLOC + SHF_WRITE
+                                                   + SHF_V850_GPREL) },
   { ".sbss",             5, -2, SHT_NOBITS,       (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_GPREL) },
   { ".scommon",          8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_GPREL) },
+  { NULL,        0, 0, 0,            0 }
+};
+
+static struct bfd_elf_special_section const
+  v850_special_sections_t[]=
+{
   { ".tdata",            6, -2, SHT_PROGBITS,     (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_EPREL) },
   { ".tbss",             5, -2, SHT_NOBITS,       (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_EPREL) },
   { ".tcommon",          8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_R0REL) },
+  { NULL,               0,   0, 0,                0 }
+};
+
+static struct bfd_elf_special_section const
+  v850_special_sections_z[]=
+{
   { ".zdata",            6, -2, SHT_PROGBITS,     (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_R0REL) },
-  { ".rozdata",          8, -2, SHT_PROGBITS,     (SHF_ALLOC
-                                                   + SHF_V850_R0REL) },
   { ".zbss",             5, -2, SHT_NOBITS,       (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_R0REL) },
   { ".zcommon",          8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE
                                                    + SHF_V850_R0REL) },
-  { ".call_table_data", 16,  0, SHT_PROGBITS,     (SHF_ALLOC
-                                                   + SHF_WRITE) },
-  { ".call_table_text", 16,  0, SHT_PROGBITS,     (SHF_ALLOC + SHF_WRITE
-                                                   + SHF_EXECINSTR) },
-  { NULL,               0,   0, 0,                0 }
+  { NULL,        0, 0, 0,            0 }
+};
+
+static struct bfd_elf_special_section const *
+  v850_elf_special_sections[27] =
+{
+  NULL,                                /* 'a' */
+  NULL,                                /* 'b' */
+  v850_special_sections_c,     /* 'c' */
+  NULL,                                /* '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' */
+  v850_special_sections_r,     /* 'r' */
+  v850_special_sections_s,     /* 's' */
+  v850_special_sections_t,     /* 't' */
+  NULL,                                /* 'u' */
+  NULL,                                /* 'v' */
+  NULL,                                /* 'w' */
+  NULL,                                /* 'x' */
+  NULL,                                /* 'y' */
+  v850_special_sections_z,     /* 'z' */
+  NULL                         /* other */
 };
 \f
 #define TARGET_LITTLE_SYM                      bfd_elf32_v850_vec
This page took 0.025673 seconds and 4 git commands to generate.