]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elf-bfd.h (struct elf_backend_data
authorAlan Modra <amodra@gmail.com>
Thu, 21 May 2009 14:15:50 +0000 (14:15 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 21 May 2009 14:15:50 +0000 (14:15 +0000)
<elf_backend_link_output_symbol_hook>): Return an int.
* elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop
symbols on deleted .opd entries.
* elflink.c (elf_link_output_sym): Return without outputting sym
if output_symbol_hook returns 2.
(elf_link_output_extsym): Don't assign h->indx when symbol discarded.
Abort if we must not discard sym.
(elf_link_input_bfd): Similarly, don't set finfo->indices for
local syms.
(bfd_elf_final_link): Adjust elf_link_output_sym calls.
* elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for
elf_backend_link_output_symbol_hook return type change.
* elf32-arm.c (output_arch_syminfo): Likewise.
(elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise.
(elf32_arm_output_arch_local_syms): Likewise.
* elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise.
* elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise.
(bfd_score_elf_link_output_symbol_hook): Likewise.
* elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
* elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
* elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise.
* elf32-spu.c (spu_elf_output_symbol_hook): Likewise.
* elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
* elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
* elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
* elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
* elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
* elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.

19 files changed:
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf-vxworks.c
bfd/elf32-arm.c
bfd/elf32-cr16c.c
bfd/elf32-score.c
bfd/elf32-score.h
bfd/elf32-score7.c
bfd/elf32-sh64.c
bfd/elf32-spu.c
bfd/elf32-v850.c
bfd/elf64-hppa.c
bfd/elf64-mmix.c
bfd/elf64-ppc.c
bfd/elf64-sh64.c
bfd/elf64-sparc.c
bfd/elflink.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h

index 50ef873301b74f85b2bddebb75e08376fdfdfc4c..68443df72106f2aefc25397a6dde3346e46f05c1 100644 (file)
@@ -1,3 +1,36 @@
+2009-05-21  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-bfd.h (struct elf_backend_data
+       <elf_backend_link_output_symbol_hook>): Return an int.
+       * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop
+       symbols on deleted .opd entries.
+       * elflink.c (elf_link_output_sym): Return without outputting sym
+       if output_symbol_hook returns 2.
+       (elf_link_output_extsym): Don't assign h->indx when symbol discarded.
+       Abort if we must not discard sym.
+       (elf_link_input_bfd): Similarly, don't set finfo->indices for
+       local syms.
+       (bfd_elf_final_link): Adjust elf_link_output_sym calls.
+       * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for
+       elf_backend_link_output_symbol_hook return type change.
+       * elf32-arm.c (output_arch_syminfo): Likewise.
+       (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise.
+       (elf32_arm_output_arch_local_syms): Likewise.
+       * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise.
+       * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise.
+       (bfd_score_elf_link_output_symbol_hook): Likewise.
+       * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
+       * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
+       * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise.
+       * elf32-spu.c (spu_elf_output_symbol_hook): Likewise.
+       * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
+       * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
+       * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
+       * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
+       * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
+       * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
+
 2009-05-21  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't segfault on
index 5761923cddaf17a3e5af22145837dd886b774df8..2fbff305e1b5ceb3ed291f06f734005d810bda7c 100644 (file)
@@ -745,8 +745,10 @@ struct elf_backend_data
      const char **name, flagword *flags, asection **sec, bfd_vma *value);
 
   /* If this field is not NULL, it is called by the elf_link_output_sym
-     phase of a link for each symbol which will appear in the object file.  */
-  bfd_boolean (*elf_backend_link_output_symbol_hook)
+     phase of a link for each symbol which will appear in the object file.
+     On error, this function returns 0.  1 is returned when the symbol
+     should be output, 2 is returned when the symbol should be discarded.  */
+  int (*elf_backend_link_output_symbol_hook)
     (struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
      asection *, struct elf_link_hash_entry *);
 
index 2b0c725f3fd1dd267d516dc72b2c068ec03a28e4..b26320cfe3693d60c4861b6d37365eb3cbddd3a0 100644 (file)
@@ -127,7 +127,7 @@ elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info,
 }
 
 /* Tweak magic VxWorks symbols as they are written to the output file.  */
-bfd_boolean
+int
 elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
                                       ATTRIBUTE_UNUSED,
                                     const char *name,
@@ -141,7 +141,7 @@ elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
       && elf_vxworks_gott_symbol_p (h->root.u.undef.abfd, name))
     sym->st_info = ELF_ST_INFO (STB_GLOBAL, ELF_ST_TYPE (sym->st_info));
 
-  return TRUE;
+  return 1;
 }
 
 /* Copy relocations into the output file.  Fixes up relocations against PLT
index 1dbac1d77c09709c63a49486f74ba6d0b4b3397b..7c82966722eb409dacb0dae3afe1f02e3b3112df 100644 (file)
@@ -11998,8 +11998,8 @@ typedef struct
   struct bfd_link_info *info;
   asection *sec;
   int sec_shndx;
-  bfd_boolean (*func) (void *, const char *, Elf_Internal_Sym *,
-                      asection *, struct elf_link_hash_entry *);
+  int (*func) (void *, const char *, Elf_Internal_Sym *,
+              asection *, struct elf_link_hash_entry *);
 } output_arch_syminfo;
 
 enum map_symbol_type
@@ -12029,9 +12029,7 @@ elf32_arm_output_map_sym (output_arch_syminfo *osi,
   sym.st_other = 0;
   sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
   sym.st_shndx = osi->sec_shndx;
-  if (!osi->func (osi->finfo, names[type], &sym, osi->sec, NULL))
-    return FALSE;
-  return TRUE;
+  return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
 }
 
 
@@ -12129,9 +12127,7 @@ elf32_arm_output_stub_sym (output_arch_syminfo *osi, const char *name,
   sym.st_other = 0;
   sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
   sym.st_shndx = osi->sec_shndx;
-  if (!osi->func (osi->finfo, name, &sym, osi->sec, NULL))
-    return FALSE;
-  return TRUE;
+  return osi->func (osi->finfo, name, &sym, osi->sec, NULL) == 1;
 }
 
 static bfd_boolean
@@ -12244,10 +12240,10 @@ static bfd_boolean
 elf32_arm_output_arch_local_syms (bfd *output_bfd,
                                  struct bfd_link_info *info,
                                  void *finfo,
-                                 bfd_boolean (*func) (void *, const char *,
-                                                      Elf_Internal_Sym *,
-                                                      asection *,
-                                                      struct elf_link_hash_entry *))
+                                 int (*func) (void *, const char *,
+                                              Elf_Internal_Sym *,
+                                              asection *,
+                                              struct elf_link_hash_entry *))
 {
   output_arch_syminfo osi;
   struct elf32_arm_link_hash_table *htab;
index 08730e2e6b969b892f71645e878c3155866d32f6..fa37c1aee3c635a5a6e0291c75b7d2acad7e5fdf 100644 (file)
@@ -927,7 +927,7 @@ elf32_cr16c_add_symbol_hook (bfd *abfd,
   return TRUE;
 }
 
-static bfd_boolean
+static int
 elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
                                     const char *name ATTRIBUTE_UNUSED,
                                     Elf_Internal_Sym *sym,
@@ -946,7 +946,7 @@ elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED
        sym->st_shndx = SHN_CR16C_NCOMMON;
     }
 
-  return TRUE;
+  return 1;
 }
 
 /* Definitions for setting CR16C target vector.  */
index d5e21b5383d5ecfbe90a5aa9cb7916a6bedd6f9f..a3308286d55ff7b16a2fc3ca168fb33ef2e10699 100644 (file)
@@ -3068,7 +3068,7 @@ s3_bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
     }
 }
 
-static bfd_boolean
+static int
 s3_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
                                           const char *name ATTRIBUTE_UNUSED,
                                           Elf_Internal_Sym *sym,
@@ -3081,7 +3081,7 @@ s3_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_U
   if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
     sym->st_shndx = SHN_SCORE_SCOMMON;
 
-  return TRUE;
+  return 1;
 }
 
 static bfd_boolean
@@ -4179,7 +4179,7 @@ _bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
     return s7_bfd_score_elf_symbol_processing (abfd, asym);
 }
 
-static bfd_boolean
+static int
 _bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
      const char *name ATTRIBUTE_UNUSED,
      Elf_Internal_Sym *sym,
@@ -4194,7 +4194,7 @@ _bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNU
          common in the output file.  */
       if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
         sym->st_shndx = SHN_SCORE_SCOMMON;
-      return TRUE;
+      return 1;
     }
 
   if (bfd_get_mach (info->input_bfds) == bfd_mach_score3)
index d842051f6963caf52d705c50fd55c6b3797f32d3..54bd0922dda270bd425ab9d262a859c350ece32d 100644 (file)
@@ -61,7 +61,7 @@ s7_bfd_score_elf_add_symbol_hook (bfd *,
 extern void
 s7_bfd_score_elf_symbol_processing (bfd *, asymbol *);
 
-extern bfd_boolean
+extern int
 s7_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *,
                                           const char *,
                                           Elf_Internal_Sym *,
index 81d0dcb69412eb82baa84ec57e6fb9db549a2ca8..af37817dde3819e4c27cbb0dafe2975563b0427e 100644 (file)
@@ -2903,7 +2903,7 @@ s7_bfd_score_elf_symbol_processing (bfd *abfd, asymbol *asym)
     }
 }
 
-bfd_boolean
+int
 s7_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
                                           const char *name ATTRIBUTE_UNUSED,
                                           Elf_Internal_Sym *sym,
@@ -2916,7 +2916,7 @@ s7_bfd_score_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_U
   if (sym->st_shndx == SHN_COMMON && strcmp (input_sec->name, ".scommon") == 0)
     sym->st_shndx = SHN_SCORE_SCOMMON;
 
-  return TRUE;
+  return 1;
 }
 
 bfd_boolean
index 3de856265be896d4a17d3fe2160195fbab1ec827..cc480320c154c0bd005861f04c46c27ac546c13d 100644 (file)
@@ -60,7 +60,7 @@ static int sh64_elf_get_symbol_type
 static bfd_boolean sh64_elf_add_symbol_hook
   (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **,
    flagword *, asection **, bfd_vma *);
-static bfd_boolean sh64_elf_link_output_symbol_hook
+static int sh64_elf_link_output_symbol_hook
   (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
    struct elf_link_hash_entry *);
 static bfd_boolean sh64_backend_section_from_shdr
@@ -477,7 +477,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
    we don't need to look up and make sure to emit the main symbol for each
    DataLabel symbol.  */
 
-bfd_boolean
+static int
 sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
                                  const char *cname,
                                  Elf_Internal_Sym *sym,
@@ -492,7 +492,7 @@ sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
        name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
     }
 
-  return TRUE;
+  return 1;
 }
 
 /* Check a SH64-specific reloc and put the value to relocate to into
index 5c63d158123def342909912f9e27046d37410f45..728cb452fb01973a59671c585ad20e3002d37f7c 100644 (file)
@@ -4984,7 +4984,7 @@ spu_elf_relocate_section (bfd *output_bfd,
 
 /* Adjust _SPUEAR_ syms to point at their overlay stubs.  */
 
-static bfd_boolean
+static int
 spu_elf_output_symbol_hook (struct bfd_link_info *info,
                            const char *sym_name ATTRIBUTE_UNUSED,
                            Elf_Internal_Sym *sym,
@@ -5016,7 +5016,7 @@ spu_elf_output_symbol_hook (struct bfd_link_info *info,
          }
     }
 
-  return TRUE;
+  return 1;
 }
 
 static int spu_plugin = 0;
index 8f9eda409319e8eed13fd6f47dea97dfbdb7fe4b..5ecfa693f07e9f27dee9c50bd5609e7516369a0d 100644 (file)
@@ -2095,7 +2095,7 @@ v850_elf_add_symbol_hook (bfd *abfd,
   return TRUE;
 }
 
-static bfd_boolean
+static int
 v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
                                  const char *name ATTRIBUTE_UNUSED,
                                  Elf_Internal_Sym *sym,
@@ -2122,7 +2122,7 @@ v850_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
   sym->st_other &= ~(V850_OTHER_SDA | V850_OTHER_ZDA | V850_OTHER_TDA
                     | V850_OTHER_ERROR);
 
-  return TRUE;
+  return 1;
 }
 
 static bfd_boolean
index 1b5de6e4ef21204cc3ebbf93eda6131a52a4d1d1..0b762e40b15b3c207174484d22665d7cb52fb995 100644 (file)
@@ -184,7 +184,7 @@ static bfd_boolean elf64_hppa_mark_milli_and_exported_functions
 static bfd_boolean elf64_hppa_size_dynamic_sections
   (bfd *, struct bfd_link_info *);
 
-static bfd_boolean elf64_hppa_link_output_symbol_hook
+static int elf64_hppa_link_output_symbol_hook
   (struct bfd_link_info *, const char *, Elf_Internal_Sym *,
    asection *, struct elf_link_hash_entry *);
 
@@ -1914,7 +1914,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
    the symbols have their expected value in the normal symbol
    table.  Ick.  */
 
-static bfd_boolean
+static int
 elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
                                    const char *name,
                                    Elf_Internal_Sym *sym,
@@ -1926,7 +1926,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
   /* We may be called with the file symbol or section symbols.
      They never need munging, so it is safe to ignore them.  */
   if (!name || !eh)
-    return TRUE;
+    return 1;
 
   /* Function symbols for which we created .opd entries *may* have been
      munged by finish_dynamic_symbol and have to be un-munged here.
@@ -1942,7 +1942,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
       sym->st_shndx = hh->st_shndx;
     }
 
-  return TRUE;
+  return 1;
 }
 
 /* Finish up dynamic symbol handling.  We set the contents of various
index 9a37840a23170b0115f2965500dbe1f1db0764ae..479304769a79296771da3eaf58419ba6cdedddd0 100644 (file)
@@ -159,7 +159,7 @@ struct bpo_greg_section_info
     struct bpo_reloc_request *reloc_request;
   };
 
-static bfd_boolean mmix_elf_link_output_symbol_hook
+static int mmix_elf_link_output_symbol_hook
   PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
           asection *, struct elf_link_hash_entry *));
 
@@ -2082,7 +2082,7 @@ _bfd_mmix_check_all_relocs (abfd, info)
    the register section, and scale them down to correspond to the register
    number.  */
 
-static bfd_boolean
+static int
 mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
      struct bfd_link_info *info ATTRIBUTE_UNUSED;
      const char *name ATTRIBUTE_UNUSED;
@@ -2099,7 +2099,7 @@ mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
       sym->st_shndx = SHN_REGISTER;
     }
 
-  return TRUE;
+  return 1;
 }
 
 /* We fake a register section that holds values that are register numbers.
index ae3c3b9f3c93b20e86d804e0004d613e9928ae2e..e68edf1d379b029696a7fef4a7bcebe954567243 100644 (file)
@@ -11759,7 +11759,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
 
 /* Adjust the value of any local symbols in opd sections.  */
 
-static bfd_boolean
+static int
 ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
                              const char *name ATTRIBUTE_UNUSED,
                              Elf_Internal_Sym *elfsym,
@@ -11771,11 +11771,11 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
   bfd_vma value;
 
   if (h != NULL)
-    return TRUE;
+    return 1;
 
   opd = get_opd_info (input_sec);
   if (opd == NULL || opd->adjust == NULL)
-    return TRUE;
+    return 1;
 
   value = elfsym->st_value - input_sec->output_offset;
   if (!info->relocatable)
@@ -11783,10 +11783,10 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
 
   adjust = opd->adjust[value / 8];
   if (adjust == -1)
-    elfsym->st_value = 0;
-  else
-    elfsym->st_value += adjust;
-  return TRUE;
+    return 2;
+
+  elfsym->st_value += adjust;
+  return 1;
 }
 
 /* Finish up dynamic symbol handling.  We set the contents of various
index e76aeb7e7d289f747af1cfa8369141696ddc16fc..4d474389f809c28297bacd7d9bee93589a32f9bc 100644 (file)
@@ -2879,7 +2879,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
    we don't need to look up and make sure to emit the main symbol for each
    DataLabel symbol.  */
 
-static bfd_boolean
+static int
 sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info,
                                    const char *cname,
                                    Elf_Internal_Sym *sym,
@@ -2894,7 +2894,7 @@ sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info,
        name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
     }
 
-  return TRUE;
+  return 1;
 }
 
 /* Set bit 0 on the entry address; it always points to SHmedia code.  This
index df3fb8bb80fd6a37d866444d9e6e7710e4083bd6..e5af7281ca141ec84bfc8efd9f01efa5eeb94df5 100644 (file)
@@ -538,10 +538,11 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
 static bfd_boolean
 elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
                              struct bfd_link_info *info,
-                             PTR finfo, bfd_boolean (*func) (PTR, const char *,
-                                                             Elf_Internal_Sym *,
-                                                             asection *,
-                                                             struct elf_link_hash_entry *))
+                             PTR finfo,
+                             int (*func) (PTR, const char *,
+                                          Elf_Internal_Sym *,
+                                          asection *,
+                                          struct elf_link_hash_entry *))
 {
   int reg;
   struct _bfd_sparc_elf_app_reg *app_regs =
@@ -585,10 +586,10 @@ elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED,
        sym.st_other = 0;
        sym.st_info = ELF_ST_INFO (app_regs [reg].bind, STT_REGISTER);
        sym.st_shndx = app_regs [reg].shndx;
-       if ((*func) (finfo, app_regs [reg].name, &sym,
-                      sym.st_shndx == SHN_ABS
-                        ? bfd_abs_section_ptr : bfd_und_section_ptr,
-                      NULL))
+       if ((*func) (finfo, app_regs [reg].name, &sym,
+                    sym.st_shndx == SHN_ABS
+                    ? bfd_abs_section_ptr : bfd_und_section_ptr,
+                    NULL) != 1)
          return FALSE;
       }
 
index bfbf79a95170e1555f24685ac6942f5a74d61ccf..61c510f184c491917968152afed6935180fecdf9 100644 (file)
@@ -8196,7 +8196,7 @@ elf_link_flush_output_syms (struct elf_final_link_info *finfo,
 
 /* Add a symbol to the output symbol table.  */
 
-static bfd_boolean
+static int
 elf_link_output_sym (struct elf_final_link_info *finfo,
                     const char *name,
                     Elf_Internal_Sym *elfsym,
@@ -8205,7 +8205,7 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
 {
   bfd_byte *dest;
   Elf_External_Sym_Shndx *destshndx;
-  bfd_boolean (*output_symbol_hook)
+  int (*output_symbol_hook)
     (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
      struct elf_link_hash_entry *);
   const struct elf_backend_data *bed;
@@ -8214,8 +8214,9 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
   output_symbol_hook = bed->elf_backend_link_output_symbol_hook;
   if (output_symbol_hook != NULL)
     {
-      if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h))
-       return FALSE;
+      int ret = (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h);
+      if (ret != 1)
+       return ret;
     }
 
   if (name == NULL || *name == '\0')
@@ -8227,13 +8228,13 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
       elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
                                                            name, TRUE, FALSE);
       if (elfsym->st_name == (unsigned long) -1)
-       return FALSE;
+       return 0;
     }
 
   if (finfo->symbuf_count >= finfo->symbuf_size)
     {
       if (! elf_link_flush_output_syms (finfo, bed))
-       return FALSE;
+       return 0;
     }
 
   dest = finfo->symbuf + finfo->symbuf_count * bed->s->sizeof_sym;
@@ -8247,7 +8248,7 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
          amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
          destshndx = bfd_realloc (destshndx, amt * 2);
          if (destshndx == NULL)
-           return FALSE;
+           return 0;
          finfo->symshndxbuf = destshndx;
          memset ((char *) destshndx + amt, 0, amt);
          finfo->shndxbuf_size *= 2;
@@ -8259,7 +8260,7 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
   finfo->symbuf_count += 1;
   bfd_get_symcount (finfo->output_bfd) += 1;
 
-  return TRUE;
+  return 1;
 }
 
 /* Return TRUE if the dynamic symbol SYM in ABFD is supported.  */
@@ -8445,6 +8446,8 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
   Elf_Internal_Sym sym;
   asection *input_sec;
   const struct elf_backend_data *bed;
+  long indx;
+  int ret;
 
   if (h->root.type == bfd_link_hash_warning)
     {
@@ -8787,13 +8790,17 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
   if (strip || (input_sec->flags & SEC_EXCLUDE) != 0)
     return TRUE;
 
-  h->indx = bfd_get_symcount (finfo->output_bfd);
-
-  if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h))
+  indx = bfd_get_symcount (finfo->output_bfd);
+  ret = elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h);
+  if (ret == 0)
     {
       eoinfo->failed = TRUE;
       return FALSE;
     }
+  else if (ret == 1)
+    h->indx = indx;
+  else if (h->indx == -2)
+    abort();
 
   return TRUE;
 }
@@ -8961,6 +8968,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
       asection *isec;
       const char *name;
       Elf_Internal_Sym osym;
+      long indx;
+      int ret;
 
       *pindex = -1;
 
@@ -9048,8 +9057,6 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
              && bfd_is_local_label_name (input_bfd, name)))
        continue;
 
-      /* If we get here, we are going to output this symbol.  */
-
       osym = *isym;
 
       /* Adjust the section index for the output file.  */
@@ -9079,8 +9086,12 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
            }
        }
 
-      if (! elf_link_output_sym (finfo, name, &osym, isec, NULL))
+      indx = bfd_get_symcount (output_bfd);
+      ret = elf_link_output_sym (finfo, name, &osym, isec, NULL);
+      if (ret == 0)
        return FALSE;
+      else if (ret == 1)
+       *pindex = indx;
     }
 
   /* Relocate the contents of each section.  */
@@ -9129,6 +9140,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
                  Elf_Internal_Sym sym = isymbuf[symndx];
                  asection *sec = finfo->sections[symndx]->output_section;
                  const char *name;
+                 long indx;
+                 int ret;
 
                  name = bfd_elf_string_from_elf_section (input_bfd,
                                                          symtab_hdr->sh_link,
@@ -9143,9 +9156,14 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
 
                  sym.st_value += o->output_offset;
 
-                 finfo->indices[symndx] = bfd_get_symcount (output_bfd);
-                 if (! elf_link_output_sym (finfo, name, &sym, o, NULL))
+                 indx = bfd_get_symcount (output_bfd);
+                 ret = elf_link_output_sym (finfo, name, &sym, o, NULL);
+                 if (ret == 0)
                    return FALSE;
+                 else if (ret == 1)
+                   finfo->indices[symndx] = indx;
+                 else
+                   abort ();
                }
              elf_section_data (osec)->this_hdr.sh_info
                = finfo->indices[symndx];
@@ -9536,6 +9554,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
                          unsigned long shlink;
                          const char *name;
                          asection *osec;
+                         long indx;
 
                          if (finfo->info->strip == strip_all)
                            {
@@ -9575,12 +9594,15 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
                                }
                            }
 
-                         finfo->indices[r_symndx]
-                           = bfd_get_symcount (output_bfd);
-
-                         if (! elf_link_output_sym (finfo, name, &sym, sec,
-                                                    NULL))
+                         indx = bfd_get_symcount (output_bfd);
+                         ret = elf_link_output_sym (finfo, name, &sym, sec,
+                                                    NULL);
+                         if (ret == 0)
                            return FALSE;
+                         else if (ret == 1)
+                           finfo->indices[r_symndx] = indx;
+                         else
+                           abort ();
                        }
 
                      r_symndx = finfo->indices[r_symndx];
@@ -10332,8 +10354,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
       elfsym.st_info = 0;
       elfsym.st_other = 0;
       elfsym.st_shndx = SHN_UNDEF;
-      if (elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
-                                NULL))
+      if (elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
+                              NULL) != 1)
        goto error_return;
     }
 
@@ -10358,7 +10380,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
              elfsym.st_shndx = i;
              if (!info->relocatable)
                elfsym.st_value = o->vma;
-             if (!elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
+             if (elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL) != 1)
                goto error_return;
            }
        }
@@ -10534,7 +10556,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
      table, do it now.  */
   if (bed->elf_backend_output_arch_local_syms)
     {
-      typedef bfd_boolean (*out_sym_func)
+      typedef int (*out_sym_func)
        (void *, const char *, Elf_Internal_Sym *, asection *,
         struct elf_link_hash_entry *);
 
@@ -10645,7 +10667,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
      table, do it now.  */
   if (bed->elf_backend_output_arch_syms)
     {
-      typedef bfd_boolean (*out_sym_func)
+      typedef int (*out_sym_func)
        (void *, const char *, Elf_Internal_Sym *, asection *,
         struct elf_link_hash_entry *);
 
index 94d56be9671fbbec110bc188a8d34db8ebc3048e..034c82a0a01c6a7fd849d2eb02cbf0a071ae421b 100644 (file)
@@ -6785,7 +6785,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
    symbol.  We mark symbols as small common if appropriate.  This is
    also where we undo the increment of the value for a mips16 symbol.  */
 
-bfd_boolean
+int
 _bfd_mips_elf_link_output_symbol_hook
   (struct bfd_link_info *info ATTRIBUTE_UNUSED,
    const char *name ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym,
@@ -6801,7 +6801,7 @@ _bfd_mips_elf_link_output_symbol_hook
   if (ELF_ST_IS_MIPS16 (sym->st_other))
     sym->st_value &= ~1;
 
-  return TRUE;
+  return 1;
 }
 \f
 /* Functions for the dynamic linker.  */
index 15bd4be606aa62b9d62632efdaaaf9926a8fcee4..74735fd33bac07c81da2138629132703a2978555 100644 (file)
@@ -41,7 +41,7 @@ extern bfd_boolean _bfd_mips_elf_section_from_bfd_section
 extern bfd_boolean _bfd_mips_elf_add_symbol_hook
   (bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
    const char **, flagword *, asection **, bfd_vma *);
-extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook
+extern int _bfd_mips_elf_link_output_symbol_hook
   (struct bfd_link_info *, const char *, Elf_Internal_Sym *,
    asection *, struct elf_link_hash_entry *);
 extern bfd_boolean _bfd_mips_elf_create_dynamic_sections