[binutils-gdb] bfd/ELF: properly mark bfd_elf_{, gc_common_}final_link() as private
Jan Beulich
jbeulich@sourceware.org
Fri Nov 14 08:05:58 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=362b674aa48a7bd18012d07e4cf7f3e2122fee30
commit 362b674aa48a7bd18012d07e4cf7f3e2122fee30
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Nov 14 09:03:49 2025 +0100
bfd/ELF: properly mark bfd_elf_{,gc_common_}final_link() as private
They're solely used as hook functions (or helpers thereof), so aren't
intended to be invoked directly from outside the library. Add underscore
prefixes and make them hidden.
Diff:
---
bfd/elf-bfd.h | 8 ++++----
bfd/elf32-arm.c | 2 +-
bfd/elf32-bfin.c | 2 +-
bfd/elf32-cris.c | 3 +--
bfd/elf32-hppa.c | 2 +-
bfd/elf32-m68k.c | 2 +-
bfd/elf32-rx.c | 2 +-
bfd/elf32-spu.c | 4 ++--
bfd/elf32-tic6x.c | 5 +----
bfd/elf32-vax.c | 2 +-
bfd/elf64-alpha.c | 2 +-
bfd/elf64-hppa.c | 2 +-
bfd/elf64-ia64-vms.c | 2 +-
bfd/elf64-mmix.c | 2 +-
bfd/elflink.c | 6 +++---
bfd/elfnn-ia64.c | 2 +-
bfd/elfxx-mips.c | 2 +-
bfd/elfxx-target.h | 2 +-
18 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index e7ee074f1c7..c9aa3ff9ca9 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2843,8 +2843,8 @@ extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
(bfd *, arelent *, struct bfd_symbol *, void *,
asection *, bfd *, char **) ATTRIBUTE_HIDDEN;
-extern bool bfd_elf_final_link
- (bfd *, struct bfd_link_info *);
+extern bool _bfd_elf_final_link
+ (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
extern void _bfd_elf_gc_keep
(struct bfd_link_info *info) ATTRIBUTE_HIDDEN;
@@ -2886,8 +2886,8 @@ extern bool _bfd_elf_gc_mark_extra_sections
extern bool bfd_elf_gc_common_finalize_got_offsets
(bfd *, struct bfd_link_info *);
-extern bool bfd_elf_gc_common_final_link
- (bfd *, struct bfd_link_info *);
+extern bool _bfd_elf_gc_common_final_link
+ (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
extern bool bfd_elf_reloc_symbol_deleted_p
(bfd_vma, void *);
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index ed2f5467c1e..b1426e1744c 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -13693,7 +13693,7 @@ elf32_arm_final_link (bfd *abfd, struct bfd_link_info *info)
return false;
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
+ if (!_bfd_elf_final_link (abfd, info))
return false;
/* Process stub sections (eg BE8 encoding, ...). */
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index e5ad4d6ca0a..4da3e0ec0e7 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -5425,7 +5425,7 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] =
_bfd_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create \
bfin_link_hash_table_create
-#define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link
+#define bfd_elf32_bfd_final_link _bfd_elf_gc_common_final_link
#define elf_backend_check_relocs bfin_check_relocs
#define elf_backend_adjust_dynamic_symbol \
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 77e8201b4a6..cb88725cc50 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -4100,8 +4100,7 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBUTE_UNUSED,
elf_cris_finish_dynamic_sections
#define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections
-#define bfd_elf32_bfd_final_link \
- bfd_elf_gc_common_final_link
+#define bfd_elf32_bfd_final_link _bfd_elf_gc_common_final_link
#define elf_backend_hide_symbol elf_cris_hide_symbol
#define elf_backend_reloc_type_class elf_cris_reloc_type_class
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 3a7237dbe7d..4721cad619a 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3043,7 +3043,7 @@ elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
struct stat buf;
/* Invoke the regular ELF linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
+ if (!_bfd_elf_final_link (abfd, info))
return false;
/* If we're producing a final executable, sort the contents of the
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index b5df42d7488..b1147ad7d9f 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -4629,7 +4629,7 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
_bfd_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create \
elf_m68k_link_hash_table_create
-#define bfd_elf32_bfd_final_link bfd_elf_final_link
+#define bfd_elf32_bfd_final_link _bfd_elf_final_link
#define elf_backend_check_relocs elf_m68k_check_relocs
#define elf_backend_early_size_sections \
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 3aeb80bf1fb..5c8921e27c4 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -3684,7 +3684,7 @@ rx_final_link (bfd * abfd, struct bfd_link_info * info)
}
}
- return bfd_elf_final_link (abfd, info);
+ return _bfd_elf_final_link (abfd, info);
}
static bool
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index de051e48185..adea6d0d51c 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -3428,7 +3428,7 @@ struct _mos_param {
/* Set linker_mark and gc_mark on any sections that we will put in
overlays. These flags are used by the generic ELF linker, but we
- won't be continuing on to bfd_elf_final_link so it is OK to use
+ won't be continuing on to _bfd_elf_final_link() so it is OK to use
them. linker_mark is clear before we get here. Set segment_mark
on sections that are part of a pasted function (excluding the last
section).
@@ -4744,7 +4744,7 @@ spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
if (!spu_elf_build_stubs (info))
info->callbacks->fatal (_("%P: can not build overlay stubs: %E\n"));
- return bfd_elf_final_link (output_bfd, info);
+ return _bfd_elf_final_link (output_bfd, info);
}
/* Called when not normally emitting relocs, ie. !bfd_link_relocatable (info)
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 98b3a894ee5..eb980f9268c 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -1594,10 +1594,7 @@ elf32_tic6x_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
- return false;
-
- return true;
+ return _bfd_elf_final_link (abfd, info);
}
/* Called to pass PARAMS to the backend. We store them in the hash table
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 37a96492d61..aa21c74b3f9 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1859,7 +1859,7 @@ elf_vax_plt_sym_val (bfd_vma i, const asection *plt,
_bfd_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create \
elf_vax_link_hash_table_create
-#define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link
+#define bfd_elf32_bfd_final_link _bfd_elf_gc_common_final_link
#define elf_backend_check_relocs elf_vax_check_relocs
#define elf_backend_adjust_dynamic_symbol \
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 967c9c3c414..077539bdcfd 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -5253,7 +5253,7 @@ elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (! bfd_elf_final_link (abfd, info))
+ if (! _bfd_elf_final_link (abfd, info))
return false;
/* Now write out the computed sections. */
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 582c28f718f..d2f0211d8ad 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2992,7 +2992,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
info);
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
+ if (!_bfd_elf_final_link (abfd, info))
return false;
elf_link_hash_traverse (elf_hash_table (info),
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index 65498ee4fb9..8f80a92e23f 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -3348,7 +3348,7 @@ elf64_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
+ if (!_bfd_elf_final_link (abfd, info))
return false;
if (unwind_output_sec)
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 223a85044f2..319369b2d0b 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2216,7 +2216,7 @@ mmix_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
- if (! bfd_elf_final_link (abfd, info))
+ if (! _bfd_elf_final_link (abfd, info))
return false;
/* Since this section is marked SEC_LINKER_CREATED, it isn't output by
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 359d1c59248..ec3ad9735fe 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12616,7 +12616,7 @@ elf_final_link_free (bfd *obfd, struct elf_final_link_info *flinfo)
/* Do the final step of an ELF link. */
bool
-bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
bool dynamic;
bool emit_relocs;
@@ -15066,13 +15066,13 @@ bfd_elf_gc_common_finalize_got_offsets (bfd *abfd,
got entry reference counting is enabled. */
bool
-bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
+_bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
{
if (!bfd_elf_gc_common_finalize_got_offsets (abfd, info))
return false;
/* Invoke the regular ELF backend linker to do all the work. */
- return bfd_elf_final_link (abfd, info);
+ return _bfd_elf_final_link (abfd, info);
}
bool
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 2ff82919350..abee1516505 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -3739,7 +3739,7 @@ elfNN_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
+ if (!_bfd_elf_final_link (abfd, info))
return false;
if (unwind_output_sec)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 80e7e08308a..4460531e584 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15504,7 +15504,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
/* Invoke the regular ELF backend linker to do all the work. */
- if (!bfd_elf_final_link (abfd, info))
+ if (!_bfd_elf_final_link (abfd, info))
return false;
/* Now write out the computed sections. */
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 27b07c9b1c4..301a2d1bc93 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -278,7 +278,7 @@
#define bfd_elfNN_bfd_define_start_stop bfd_elf_define_start_stop
#endif
#ifndef bfd_elfNN_bfd_final_link
-#define bfd_elfNN_bfd_final_link bfd_elf_final_link
+#define bfd_elfNN_bfd_final_link _bfd_elf_final_link
#endif
#undef TARGET_MERGE_SECTIONS
#define TARGET_MERGE_SECTIONS true
More information about the Binutils-cvs
mailing list