* reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
[deliverable/binutils-gdb.git] / bfd / elf32-v850.c
index e71353df55f18b65d6609d8c63195bf337bef4c2..4fe28fc92b912a13a94092fb211c67a28c273291 100644 (file)
@@ -1,5 +1,5 @@
 /* V850-specific support for 32-bit ELF
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -143,7 +143,7 @@ static reloc_howto_type v850_elf_howto_table[] =
         complain_overflow_dont,        /* complain_on_overflow */
         v850_elf_reloc,                /* special_function */
         "R_V850_HI16_S",               /* name */
-        true,                          /* partial_inplace */
+        false,                         /* partial_inplace */
         0xffff,                        /* src_mask */
         0xffff,                        /* dst_mask */
         false),                        /* pcrel_offset */
@@ -158,7 +158,7 @@ static reloc_howto_type v850_elf_howto_table[] =
         complain_overflow_dont,        /* complain_on_overflow */
         v850_elf_reloc,                /* special_function */
         "R_V850_HI16",                 /* name */
-        true,                          /* partial_inplace */
+        false,                         /* partial_inplace */
         0xffff,                        /* src_mask */
         0xffff,                        /* dst_mask */
         false),                        /* pcrel_offset */
@@ -173,7 +173,7 @@ static reloc_howto_type v850_elf_howto_table[] =
         complain_overflow_dont,        /* complain_on_overflow */
         v850_elf_reloc,                /* special_function */
         "R_V850_LO16",                 /* name */
-        true,                          /* partial_inplace */
+        false,                         /* partial_inplace */
         0xffff,                        /* src_mask */
         0xffff,                        /* dst_mask */
         false),                        /* pcrel_offset */
@@ -188,7 +188,7 @@ static reloc_howto_type v850_elf_howto_table[] =
         complain_overflow_dont,        /* complain_on_overflow */
         v850_elf_reloc,                /* special_function */
         "R_V850_32",                   /* name */
-        true,                          /* partial_inplace */
+        false,                         /* partial_inplace */
         0xffffffff,                    /* src_mask */
         0xffffffff,                    /* dst_mask */
         false),                        /* pcrel_offset */
@@ -203,7 +203,7 @@ static reloc_howto_type v850_elf_howto_table[] =
         complain_overflow_dont,        /* complain_on_overflow */
         bfd_elf_generic_reloc,         /* special_function */
         "R_V850_16",                   /* name */
-        true,                          /* partial_inplace */
+        false,                         /* partial_inplace */
         0xffff,                        /* src_mask */
         0xffff,                        /* dst_mask */
         false),                        /* pcrel_offset */
@@ -218,7 +218,7 @@ static reloc_howto_type v850_elf_howto_table[] =
         complain_overflow_dont,        /* complain_on_overflow */
         bfd_elf_generic_reloc,         /* special_function */
         "R_V850_8",                    /* name */
-        true,                          /* partial_inplace */
+        false,                         /* partial_inplace */
         0xff,                          /* src_mask */
         0xff,                          /* dst_mask */
         false),                        /* pcrel_offset */
@@ -509,7 +509,7 @@ static const struct v850_elf_reloc_map v850_elf_reloc_map[] =
 /* Map a bfd relocation into the appropriate howto structure */
 static reloc_howto_type *
 v850_elf_reloc_type_lookup (abfd, code)
-     bfd *                     abfd;
+     bfd *                     abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type  code;
 {
   unsigned int i;
@@ -533,7 +533,7 @@ v850_elf_reloc_type_lookup (abfd, code)
 /* Set the howto pointer for an V850 ELF reloc.  */
 static void
 v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
-     bfd *                 abfd;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
      arelent *             cache_ptr;
      Elf32_Internal_Rel *  dst;
 {
@@ -547,7 +547,7 @@ v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
 /* Set the howto pointer for a V850 ELF reloc (type RELA). */
 static void
 v850_elf_info_to_howto_rela (abfd, cache_ptr, dst)
-     bfd *                 abfd;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
      arelent *             cache_ptr;
      Elf32_Internal_Rela   *dst;
 {
@@ -797,7 +797,6 @@ find_remembered_hi16s_reloc (addend, already_found)
   hi16s_location * entry;
   hi16s_location * previous = NULL;
   hi16s_location * prev;
-  int              i;
   bfd_byte *       addr;
   
   /* Search the table.  Record the most recent entry that matches.  */
@@ -1253,13 +1252,13 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
 /* Insert the addend into the instruction.  */
 static bfd_reloc_status_type
 v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
-     bfd *       abfd;
+     bfd *       abfd ATTRIBUTE_UNUSED;
      arelent *   reloc;
      asymbol *   symbol;
-     PTR         data;
+     PTR         data ATTRIBUTE_UNUSED;
      asection *  isection;
      bfd *       obfd;
-     char **     err;
+     char **     err ATTRIBUTE_UNUSED;
 {
   long relocation;
   
@@ -1327,7 +1326,7 @@ v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
 /*ARGSUSED*/
 static boolean
 v850_elf_is_local_label_name (abfd, name)
-     bfd *         abfd;
+     bfd *         abfd ATTRIBUTE_UNUSED;
      const char *  name;
 {
   return (   (name[0] == '.' && (name[1] == 'L' || name[1] == '.'))
@@ -1342,7 +1341,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
                                    addend, info, sym_sec, is_local)
      reloc_howto_type *      howto;
      bfd *                   input_bfd;
-     bfd *                   output_bfd;
+     bfd *                   output_bfd ATTRIBUTE_UNUSED;
      asection *              input_section;
      bfd_byte *              contents;
      bfd_vma                 offset;
@@ -1350,7 +1349,7 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
      bfd_vma                 addend;
      struct bfd_link_info *  info;
      asection *              sym_sec;
-     int                     is_local;
+     int                     is_local ATTRIBUTE_UNUSED;
 {
   unsigned long  r_type   = howto->type;
   bfd_byte *     hit_data = contents + offset;
@@ -1369,6 +1368,10 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
                + input_section->output_offset
                + offset);
 
+      /* If the sign extension will corrupt the value then we have overflowed.  */
+      if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000))
+       return bfd_reloc_overflow;
+      
       value = SEXT24 (value);  /* Only the bottom 24 bits of the PC are valid */
       break;
       
@@ -1622,7 +1625,7 @@ fprintf (stderr, "undefined: sec: %s, name: %s\n",
            {
              if (! ((*info->callbacks->undefined_symbol)
                     (info, h->root.root.string, input_bfd,
-                     input_section, rel->r_offset)))
+                     input_section, rel->r_offset, true)))
                return false;
 #if 0
 fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
@@ -1666,7 +1669,7 @@ fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
            case bfd_reloc_undefined:
              if (! ((*info->callbacks->undefined_symbol)
                     (info, name, input_bfd, input_section,
-                     rel->r_offset)))
+                     rel->r_offset, true)))
                return false;
              break;
 
@@ -1713,10 +1716,10 @@ fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
 
 static boolean
 v850_elf_gc_sweep_hook (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
 {
   /* No got and plt entries for v850-elf */
   return true;
@@ -1725,7 +1728,7 @@ v850_elf_gc_sweep_hook (abfd, info, sec, relocs)
 static asection *
 v850_elf_gc_mark_hook (abfd, info, rel, h, sym)
        bfd *abfd;
-       struct bfd_link_info *info;
+       struct bfd_link_info *info ATTRIBUTE_UNUSED;
        Elf_Internal_Rela *rel;
        struct elf_link_hash_entry *h;
        Elf_Internal_Sym *sym;
@@ -1747,6 +1750,9 @@ v850_elf_gc_mark_hook (abfd, info, rel, h, sym)
 
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
+
+         default:
+           break;
           }
        }
      }
@@ -1781,7 +1787,7 @@ v850_elf_object_p (abfd)
 static void
 v850_elf_final_write_processing (abfd, linker)
      bfd *   abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   unsigned long val;
 
@@ -1934,8 +1940,8 @@ static asymbol * v850_elf_zcom_symbol_ptr;
 
 static boolean
 v850_elf_section_from_bfd_section (abfd, hdr, sec, retval)
-     bfd *                 abfd;
-     Elf32_Internal_Shdr * hdr;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
+     Elf32_Internal_Shdr * hdr ATTRIBUTE_UNUSED;
      asection *            sec;
      int *                 retval;
 {
@@ -2053,10 +2059,10 @@ v850_elf_symbol_processing (abfd, asym)
 static boolean
 v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *                    abfd;
-     struct bfd_link_info *   info;
+     struct bfd_link_info *   info ATTRIBUTE_UNUSED;
      const Elf_Internal_Sym * sym;
-     const char **            namep;
-     flagword *               flagsp;
+     const char **            namep ATTRIBUTE_UNUSED;
+     flagword *               flagsp ATTRIBUTE_UNUSED;
      asection **              secp;
      bfd_vma *                valp;
 {
@@ -2114,9 +2120,9 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
 /*ARGSIGNORED*/
 static boolean
 v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
-     bfd *                  abfd;
-     struct bfd_link_info * info;
-     const char *           name;
+     bfd *                  abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info * info ATTRIBUTE_UNUSED;
+     const char *           name ATTRIBUTE_UNUSED;
      Elf_Internal_Sym *     sym;
      asection *             input_sec;
 {
@@ -2169,7 +2175,7 @@ v850_elf_section_from_shdr (abfd, hdr, name)
    section name, which is a hack, but ought to work.  */
 static boolean
 v850_elf_fake_sections (abfd, hdr, sec)
-     bfd *                 abfd;
+     bfd *                 abfd ATTRIBUTE_UNUSED;
      Elf32_Internal_Shdr * hdr;
      asection *            sec;
 {
This page took 0.0281 seconds and 4 git commands to generate.