[PATCH] bfd/ELF: properly mark bfd_elf_{,gc_common_}final_link() as private
Jan Beulich
jbeulich@suse.com
Fri Nov 7 14:08:08 GMT 2025
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.
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2843,8 +2843,8 @@ extern bfd_reloc_status_type _bfd_elf_re
(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_secti
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 *);
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -13693,7 +13693,7 @@ elf32_arm_final_link (bfd *abfd, struct
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, ...). */
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -5425,7 +5425,7 @@ struct bfd_elf_special_section const elf
_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 \
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -4100,8 +4100,7 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBU
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
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3043,7 +3043,7 @@ elf32_hppa_final_link (bfd *abfd, struct
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
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -4629,7 +4629,7 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Int
_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 \
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -3684,7 +3684,7 @@ rx_final_link (bfd * abfd, struct bfd_li
}
}
- return bfd_elf_final_link (abfd, info);
+ return _bfd_elf_final_link (abfd, info);
}
static bool
--- 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, str
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)
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -1594,10 +1594,7 @@ elf32_tic6x_final_link (bfd *abfd, struc
}
}
/* 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
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1859,7 +1859,7 @@ elf_vax_plt_sym_val (bfd_vma i, const as
_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 \
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -5253,7 +5253,7 @@ elf64_alpha_final_link (bfd *abfd, struc
}
/* 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. */
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2992,7 +2992,7 @@ elf_hppa_final_link (bfd *abfd, struct b
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),
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -3348,7 +3348,7 @@ elf64_ia64_final_link (bfd *abfd, struct
}
/* 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)
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2216,7 +2216,7 @@ mmix_elf_final_link (bfd *abfd, struct b
}
}
- 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
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12616,7 +12616,7 @@ elf_final_link_free (bfd *obfd, struct e
/* 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 (
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
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -3739,7 +3739,7 @@ elfNN_ia64_final_link (bfd *abfd, struct
}
/* 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)
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15504,7 +15504,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str
}
/* 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. */
--- 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
mailing list