]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/COFF: drop link_add_one_symbol() hook
authorJan Beulich <jbeulich@suse.com>
Mon, 7 Apr 2025 10:46:16 +0000 (12:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 7 Apr 2025 10:46:16 +0000 (12:46 +0200)
The need for this has disappeared with dc12032bca08 ("Remove m68k-aout
and m68k-coff support"); avoid the unnecessary indirection.

Sadly, with ld/pe-dll.c using the wrapper, the removal requires moving
the declaration out of libcoff.h, to properly export the underlying BFD
function.

14 files changed:
bfd/bfd-in2.h
bfd/coff-alpha.c
bfd/coff-arm.c
bfd/coff-mips.c
bfd/coff-rs6000.c
bfd/coff-sh.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/cofflink.c
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libcoff.h
bfd/linker.c
ld/pe-dll.c

index 7a8318e19af4f42132aa4fe68c22fcdc9c858053..ec60f23f61b6f6e5c69d05c71dd417ddeacb8c52 100644 (file)
@@ -2913,6 +2913,18 @@ const char *bfd_format_string (bfd_format format);
    && bfd_is_abs_section ((H)->u.def.section) \
    && !(H)->rel_from_abs)
 
+bool _bfd_generic_link_add_one_symbol
+   (struct bfd_link_info *info,
+    bfd *abfd,
+    const char *name,
+    flagword flags,
+    asection *section,
+    bfd_vma value,
+    const char *string,
+    bool copy,
+    bool collect,
+    struct bfd_link_hash_entry **hashp);
+
 bool bfd_link_align_section (asection *, unsigned int);
 
 bool bfd_link_split_section (bfd *abfd, asection *sec);
index 2798efd299a2c0f3ff0d8813f77b1d8ab564a18d..e2f1a4d28080383f4f29396ed2d9d1d30f9a9dad 100644 (file)
@@ -2359,7 +2359,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
     alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL, NULL
+    NULL, NULL, NULL,
   },
   /* Supported architecture.  */
   bfd_arch_alpha,
index ab5f7b0663f3b6f0c09dd67e1e9b6e6d5817e092..ee574518b771ce9c8846cd71159e8414f66c400e 100644 (file)
@@ -1876,8 +1876,8 @@ record_arm_to_thumb_glue (struct bfd_link_info *  info,
      it.  */
   bh = NULL;
   val = globals->arm_glue_size + 1;
-  bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
-                               BSF_GLOBAL, s, val, NULL, true, false, &bh);
+  _bfd_generic_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
+                                   BSF_GLOBAL, s, val, NULL, true, false, &bh);
 
   free (tmp_name);
 
@@ -1929,8 +1929,8 @@ record_thumb_to_arm_glue (struct bfd_link_info *  info,
 
   bh = NULL;
   val = globals->thumb_glue_size + 1;
-  bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
-                               BSF_GLOBAL, s, val, NULL, true, false, &bh);
+  _bfd_generic_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
+                                   BSF_GLOBAL, s, val, NULL, true, false, &bh);
 
   /* If we mark it 'thumb', the disassembler will do a better job.  */
   myh = (struct coff_link_hash_entry *) bh;
@@ -1952,8 +1952,8 @@ record_thumb_to_arm_glue (struct bfd_link_info *  info,
 
   bh = NULL;
   val = globals->thumb_glue_size + (globals->support_old_code ? 8 : 4);
-  bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
-                               BSF_LOCAL, s, val, NULL, true, false, &bh);
+  _bfd_generic_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
+                                   BSF_LOCAL, s, val, NULL, true, false, &bh);
 
   free (tmp_name);
 
index e2c632c8a0b78c670ae48e8cc37d06f777e56a45..8c4d4f7bf733b9c276c49f58190d9c6463d19b74 100644 (file)
@@ -1316,7 +1316,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
     _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
     _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL
+    NULL, NULL,
   },
   /* Supported architecture.  */
   bfd_arch_mips,
index 7a20dba5d9c34f7904173b600ec5d81cfab6df42..ae9a0f613abb94a808f25f14e06414fb2cea36ea 100644 (file)
@@ -4584,7 +4584,6 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
       xcoff_ppc_relocate_section,
       coff_rtype_to_howto,
       NULL,                    /* _bfd_coff_adjust_symndx */
-      _bfd_generic_link_add_one_symbol,
       coff_link_output_has_begun,
       coff_final_link_postscript,
       NULL                     /* print_pdata.  */
@@ -4774,7 +4773,6 @@ static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
       xcoff_ppc_relocate_section,
       coff_rtype_to_howto,
       NULL,                    /* _bfd_coff_adjust_symndx */
-      _bfd_generic_link_add_one_symbol,
       coff_link_output_has_begun,
       coff_final_link_postscript,
       NULL                     /* print_pdata.  */
index 275c4f5c2b5cb010bbdd943eb9925d90cb0059d7..c3e0e42023090de5c9bf301539ca8cf4d9ef05a7 100644 (file)
@@ -3108,7 +3108,7 @@ static const bfd_coff_backend_data bfd_coff_small_swap_table =
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
-  coff_adjust_symndx, coff_link_add_one_symbol,
+  coff_adjust_symndx,
   coff_link_output_has_begun, coff_final_link_postscript,
   bfd_pe_print_pdata
 };
index 5a4bcbf206a17c2f9e3c6bb02fc382e169a1bf26..ec7ed08d3d08fa5a0a13c28571ecbbb7cea303f0 100644 (file)
@@ -2495,7 +2495,6 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
       xcoff64_ppc_relocate_section,
       coff_rtype_to_howto,
       NULL,                    /* _bfd_coff_adjust_symndx */
-      _bfd_generic_link_add_one_symbol,
       coff_link_output_has_begun,
       coff_final_link_postscript,
       NULL                     /* print_pdata.  */
@@ -2768,7 +2767,6 @@ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
       xcoff64_ppc_relocate_section,
       coff_rtype_to_howto,
       NULL,                    /* _bfd_coff_adjust_symndx */
-      _bfd_generic_link_add_one_symbol,
       coff_link_output_has_begun,
       coff_final_link_postscript,
       NULL                     /* print_pdata.  */
index 325a8ab1b2f79b73785e758e40537b184021ccfc..bd0374fbfdda09e7b82a29483c584a4d4bce2feb 100644 (file)
@@ -1516,11 +1516,6 @@ CODE_FRAGMENT
 .    (bfd *, struct bfd_link_info *, bfd *, asection *,
 .     struct internal_reloc *, bool *);
 .
-.  bool (*_bfd_coff_link_add_one_symbol)
-.    (struct bfd_link_info *, bfd *, const char *, flagword,
-.     asection *, bfd_vma, const char *, bool, bool,
-.     struct bfd_link_hash_entry **);
-.
 .  bool (*_bfd_coff_link_output_has_begun)
 .    (bfd *, struct coff_final_link_info *);
 .
@@ -1659,10 +1654,6 @@ INTERNAL
 .#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
 .  ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
 .   (obfd, info, ibfd, sec, rel, adjustedp))
-.#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
-.                                    value, string, cp, coll, hashp)\
-.  ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
-.   (info, abfd, name, flags, section, value, string, cp, coll, hashp))
 .
 .#define bfd_coff_link_output_has_begun(a,p) \
 .  ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
@@ -5513,10 +5504,6 @@ dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED,
 #define coff_adjust_symndx NULL
 #endif
 
-#ifndef coff_link_add_one_symbol
-#define coff_link_add_one_symbol _bfd_generic_link_add_one_symbol
-#endif
-
 #ifndef coff_link_output_has_begun
 
 static bool
@@ -5615,7 +5602,7 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED =
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
-  coff_adjust_symndx, coff_link_add_one_symbol,
+  coff_adjust_symndx,
   coff_link_output_has_begun, coff_final_link_postscript,
   bfd_pe_print_pdata
 };
@@ -5656,7 +5643,7 @@ static const bfd_coff_backend_data ticoff0_swap_table =
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
-  coff_adjust_symndx, coff_link_add_one_symbol,
+  coff_adjust_symndx,
   coff_link_output_has_begun, coff_final_link_postscript,
   bfd_pe_print_pdata
 };
@@ -5698,7 +5685,7 @@ static const bfd_coff_backend_data ticoff1_swap_table =
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
-  coff_adjust_symndx, coff_link_add_one_symbol,
+  coff_adjust_symndx,
   coff_link_output_has_begun, coff_final_link_postscript,
   bfd_pe_print_pdata   /* huh */
 };
@@ -5941,7 +5928,7 @@ static const bfd_coff_backend_data bigobj_swap_table =
   coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate,
   coff_classify_symbol, coff_compute_section_file_positions,
   coff_start_final_link, coff_relocate_section, coff_rtype_to_howto,
-  coff_adjust_symndx, coff_link_add_one_symbol,
+  coff_adjust_symndx,
   coff_link_output_has_begun, coff_final_link_postscript,
   bfd_pe_print_pdata   /* huh */
 };
index 876aed7a0d2f4bcaf445c7b50ed489f2f8e32d7b..501731bd811c13ee6dd7c265933a5a873de5b6ae 100644 (file)
@@ -445,7 +445,7 @@ coff_link_add_symbols (bfd *abfd,
 
          if (addit)
            {
-             if (! (bfd_coff_link_add_one_symbol
+             if (! (_bfd_generic_link_add_one_symbol
                     (info, abfd, name, flags, section, value,
                      (const char *) NULL, copy, false,
                      (struct bfd_link_hash_entry **) sym_hash)))
index b2f70fbfdac82c506ef7d37776bf2898ad680308..ae6d3039017a0b959d23bdd2b321097391231d29 100644 (file)
@@ -645,12 +645,6 @@ extern bool _bfd_generic_link_add_archive_symbols
 /* Forward declaration to avoid prototype errors.  */
 typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
 
-/* Generic routine to add a single symbol.  */
-extern bool _bfd_generic_link_add_one_symbol
-  (struct bfd_link_info *, bfd *, const char *name, flagword,
-   asection *, bfd_vma, const char *, bool copy,
-   bool constructor, struct bfd_link_hash_entry **) ATTRIBUTE_HIDDEN;
-
 /* Generic routine to mark section as supplying symbols only.  */
 extern void _bfd_generic_link_just_syms
   (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
index 4f6f5ea2f8ae385073714172675c7e7fde874cc4..d367fea33d3c06a6d0601462cd65a91a9fe60d55 100644 (file)
@@ -651,12 +651,6 @@ extern bool _bfd_generic_link_add_archive_symbols
 /* Forward declaration to avoid prototype errors.  */
 typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
 
-/* Generic routine to add a single symbol.  */
-extern bool _bfd_generic_link_add_one_symbol
-  (struct bfd_link_info *, bfd *, const char *name, flagword,
-   asection *, bfd_vma, const char *, bool copy,
-   bool constructor, struct bfd_link_hash_entry **) ATTRIBUTE_HIDDEN;
-
 /* Generic routine to mark section as supplying symbols only.  */
 extern void _bfd_generic_link_just_syms
   (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
index d0cfd09709a42d6cb4dce1fbb47d9718e2171b5a..05ebe3583633fb5bd3041cd984b6baa59a11f2df 100644 (file)
@@ -864,11 +864,6 @@ typedef struct
     (bfd *, struct bfd_link_info *, bfd *, asection *,
      struct internal_reloc *, bool *);
 
-  bool (*_bfd_coff_link_add_one_symbol)
-    (struct bfd_link_info *, bfd *, const char *, flagword,
-     asection *, bfd_vma, const char *, bool, bool,
-     struct bfd_link_hash_entry **);
-
   bool (*_bfd_coff_link_output_has_begun)
     (bfd *, struct coff_final_link_info *);
 
@@ -1005,10 +1000,6 @@ typedef struct
 #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
   ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
    (obfd, info, ibfd, sec, rel, adjustedp))
-#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
-                                    value, string, cp, coll, hashp)\
-  ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
-   (info, abfd, name, flags, section, value, string, cp, coll, hashp))
 
 #define bfd_coff_link_output_has_begun(a,p) \
   ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p))
index 2a4b8f02fe6260ae0ba1b7b93af397765e695814..a9a23e5b9de9b2641f93e869f5ca834136f6aa13 100644 (file)
@@ -1378,7 +1378,25 @@ hash_entry_bfd (struct bfd_link_hash_entry *h)
   /*NOTREACHED*/
 }
 
-/* Add a symbol to the global hash table.
+/*
+FUNCTION
+       _bfd_generic_link_add_one_symbol
+
+SYNOPSIS
+       bool _bfd_generic_link_add_one_symbol
+         (struct bfd_link_info *info,
+          bfd *abfd,
+          const char *name,
+          flagword flags,
+          asection *section,
+          bfd_vma value,
+          const char *string,
+          bool copy,
+          bool collect,
+          struct bfd_link_hash_entry **hashp);
+
+DESCRIPTION
+   Add a symbol to the global hash table.
    ABFD is the BFD the symbol comes from.
    NAME is the name of the symbol.
    FLAGS is the BSF_* bits associated with the symbol.
index de1cfafb65bc246307a67c71582476393143de36..4a2ea036518597743ad7116a5ce7f6e41c24fe70 100644 (file)
@@ -2639,9 +2639,9 @@ make_import_fixup_mark (arelent *rel, char *name)
   memcpy (fixup_name, buf, prefix_len);
 
   bh = NULL;
-  bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL,
-                               current_sec, /* sym->section, */
-                               rel->address, NULL, true, false, &bh);
+  _bfd_generic_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL,
+                                   current_sec, /* sym->section, */
+                                   rel->address, NULL, true, false, &bh);
 
   return bh->root.string;
 }