From: Jan Beulich Date: Fri, 7 Nov 2025 14:00:25 +0000 (+0100) Subject: bfd/ELF: mark functions exposed to ld as non-private X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3dd2eb6f595475852f6b7e383192a6f593710ad;p=thirdparty%2Fbinutils-gdb.git bfd/ELF: mark functions exposed to ld as non-private As non-private functions, these shouldn't have "_bfd_" prefixes, but merely "bfd_" ones: - _bfd_elf_size_group_sections(), - _bfd_elf_match_sections_by_type(), - _bfd_elf_strtab_{str,len}(), - _bfd_elf_map_sections_to_segments(), - _bfd_elf_tls_setup(). --- diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 6d55c745837..daad1a938f0 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2381,7 +2381,7 @@ extern bool _bfd_elf_link_hash_table_init unsigned int) ATTRIBUTE_HIDDEN; extern bool _bfd_elf_slurp_version_tables (bfd *, bool) ATTRIBUTE_HIDDEN; -extern bool _bfd_elf_match_sections_by_type +extern bool bfd_elf_match_sections_by_type (bfd *, const asection *, bfd *, const asection *); extern bool bfd_elf_is_group_section (bfd *, const struct bfd_section *); @@ -2399,7 +2399,7 @@ extern asection *_bfd_elf_check_kept_section extern void _bfd_elf_copy_link_hash_symbol_type (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *) ATTRIBUTE_HIDDEN; -extern bool _bfd_elf_size_group_sections +extern bool bfd_elf_size_group_sections (struct bfd_link_info *); extern bool _bfd_elf_fixup_group_sections (bfd *, asection *) ATTRIBUTE_HIDDEN; @@ -2516,11 +2516,11 @@ extern void _bfd_elf_strtab_restore (struct elf_strtab_hash *, void *) ATTRIBUTE_HIDDEN; extern bfd_size_type _bfd_elf_strtab_size (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN; -extern bfd_size_type _bfd_elf_strtab_len +extern bfd_size_type bfd_elf_strtab_len (struct elf_strtab_hash *); extern bfd_size_type _bfd_elf_strtab_offset (struct elf_strtab_hash *, size_t) ATTRIBUTE_HIDDEN; -extern const char * _bfd_elf_strtab_str +extern const char *bfd_elf_strtab_str (struct elf_strtab_hash *, size_t idx, bfd_size_type *offset); extern bool _bfd_elf_strtab_emit (bfd *, struct elf_strtab_hash *) ATTRIBUTE_HIDDEN; @@ -2622,7 +2622,7 @@ extern int bfd_elf_discard_info (bfd *, struct bfd_link_info *); extern unsigned int _bfd_elf_default_action_discarded (struct bfd_section *) ATTRIBUTE_HIDDEN; -extern struct bfd_section *_bfd_elf_tls_setup +extern struct bfd_section *bfd_elf_tls_setup (bfd *, struct bfd_link_info *); extern bool _bfd_elf_link_create_dynamic_sections @@ -2895,7 +2895,7 @@ extern bool bfd_elf_reloc_symbol_deleted_p extern struct elf_segment_map * _bfd_elf_make_dynamic_segment (bfd *, asection *) ATTRIBUTE_HIDDEN; -extern bool _bfd_elf_map_sections_to_segments +extern bool bfd_elf_map_sections_to_segments (bfd *, struct bfd_link_info *, bool *); extern bool _bfd_elf_is_function_type diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 9b0b0b8ec60..e394064dc5c 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -275,7 +275,7 @@ _bfd_elf_strtab_size (struct elf_strtab_hash *tab) } bfd_size_type -_bfd_elf_strtab_len (struct elf_strtab_hash *tab) +bfd_elf_strtab_len (struct elf_strtab_hash *tab) { return tab->size; } @@ -296,8 +296,8 @@ _bfd_elf_strtab_offset (struct elf_strtab_hash *tab, size_t idx) } const char * -_bfd_elf_strtab_str (struct elf_strtab_hash *tab, size_t idx, - bfd_size_type *offset) +bfd_elf_strtab_str (struct elf_strtab_hash *tab, size_t idx, + bfd_size_type *offset) { if (idx == 0) return NULL; diff --git a/bfd/elf.c b/bfd/elf.c index e6e6a348eca..e2c02440612 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5085,9 +5085,9 @@ elf_modify_segment_map (bfd *abfd, NEED_LAYOUT if the section layout is changed. */ bool -_bfd_elf_map_sections_to_segments (bfd *abfd, - struct bfd_link_info *info, - bool *need_layout) +bfd_elf_map_sections_to_segments (bfd *abfd, + struct bfd_link_info *info, + bool *need_layout) { unsigned int count; struct elf_segment_map *m; @@ -5906,7 +5906,7 @@ assign_file_positions_for_load_sections (bfd *abfd, unsigned int opb = bfd_octets_per_byte (abfd, NULL); if (link_info == NULL - && !_bfd_elf_map_sections_to_segments (abfd, link_info, NULL)) + && !bfd_elf_map_sections_to_segments (abfd, link_info, NULL)) return false; alloc = 0; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 9625ff2a5b7..c549b832b7f 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4354,7 +4354,7 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) elf_section_flags (htab->elf.splt->output_section) = SHF_ALLOC + SHF_WRITE; } - return _bfd_elf_tls_setup (obfd, info); + return bfd_elf_tls_setup (obfd, info); } /* Return TRUE iff REL is a branch reloc with a global symbol matching diff --git a/bfd/elflink.c b/bfd/elflink.c index 635fdec8bbe..e2f5425ba39 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -3617,7 +3617,7 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, aligned. Returns the first TLS output section. */ struct bfd_section * -_bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) +bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) { struct bfd_section *sec, *tls; unsigned int align = 0; @@ -3910,8 +3910,7 @@ _bfd_elf_strip_zero_sized_dynamic_sections (struct bfd_link_info *info) { /* Regenerate program headers. */ elf_seg_map (info->output_bfd) = NULL; - return _bfd_elf_map_sections_to_segments (info->output_bfd, info, - NULL); + return bfd_elf_map_sections_to_segments (info->output_bfd, info, NULL); } return true; @@ -6797,7 +6796,7 @@ compute_bucket_count (struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Size any SHT_GROUP section for ld -r. */ bool -_bfd_elf_size_group_sections (struct bfd_link_info *info) +bfd_elf_size_group_sections (struct bfd_link_info *info) { bfd *ibfd; asection *s; @@ -7429,7 +7428,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, } if (bfd_link_relocatable (info) - && !_bfd_elf_size_group_sections (info)) + && !bfd_elf_size_group_sections (info)) return false; /* Determine any GNU_STACK segment requirements, after the backend @@ -8971,8 +8970,8 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, /* Return TRUE if 2 section types are compatible. */ bool -_bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec, - bfd *bbfd, const asection *bsec) +bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec, + bfd *bbfd, const asection *bsec) { if (asec == NULL || bsec == NULL diff --git a/ld/emultempl/genelf.em b/ld/emultempl/genelf.em index b04e046208f..992888dd45a 100644 --- a/ld/emultempl/genelf.em +++ b/ld/emultempl/genelf.em @@ -56,7 +56,7 @@ static void gld${EMULATION_NAME}_before_allocation (void) { if (bfd_link_relocatable (&link_info) - && !_bfd_elf_size_group_sections (&link_info)) + && !bfd_elf_size_group_sections (&link_info)) einfo (_("%X%P: can not size group sections: %E\n")); before_allocation_default (); } diff --git a/ld/emultempl/loongarchelf.em b/ld/emultempl/loongarchelf.em index 517ece16105..e86ff5c2671 100644 --- a/ld/emultempl/loongarchelf.em +++ b/ld/emultempl/loongarchelf.em @@ -84,9 +84,8 @@ gld${EMULATION_NAME}_after_allocation (void) { if (lang_phdr_list == NULL) elf_seg_map (link_info.output_bfd) = NULL; - if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd, - &link_info, - NULL)) + if (!bfd_elf_map_sections_to_segments (link_info.output_bfd, + &link_info, NULL)) fatal (_("%P: map sections to segments failed: %E\n")); } diff --git a/ld/ldelf.c b/ld/ldelf.c index f4f27fc3873..03b06ac1425 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -1763,7 +1763,7 @@ ldelf_before_allocation (char **audit, char **depaudit, if (is_elf_hash_table (link_info.hash)) { - _bfd_elf_tls_setup (link_info.output_bfd, &link_info); + bfd_elf_tls_setup (link_info.output_bfd, &link_info); /* Make __ehdr_start hidden if it has been referenced, to prevent the symbol from being dynamic. */ @@ -2094,8 +2094,8 @@ elf_orphan_compatible (asection *in, asection *out) || ((elf_section_flags (out) ^ elf_section_flags (in)) & (SHF_MASKPROC | SHF_MASKOS)) != 0)) return false; - return _bfd_elf_match_sections_by_type (link_info.output_bfd, out, - in->owner, in); + return bfd_elf_match_sections_by_type (link_info.output_bfd, out, + in->owner, in); } /* Place an orphan section. We use this to put random SHF_ALLOC @@ -2314,8 +2314,8 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint) && ((nexts->flags ^ flags) & (SEC_LOAD | SEC_ALLOC)) == 0 && (nexts->owner->flags & DYNAMIC) == 0 && !bfd_input_just_syms (nexts->owner) - && _bfd_elf_match_sections_by_type (nexts->owner, nexts, - s->owner, s)) + && bfd_elf_match_sections_by_type (nexts->owner, nexts, + s->owner, s)) flags = (((flags ^ SEC_READONLY) | (nexts->flags ^ SEC_READONLY)) ^ SEC_READONLY); @@ -2383,7 +2383,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint) if (after == NULL) after = lang_output_section_find_by_flags (s, flags, &place->os, - _bfd_elf_match_sections_by_type); + bfd_elf_match_sections_by_type); if (after == NULL) /* *ABS* is always the first output section statement. */ after = (void *) lang_os_list.head; diff --git a/ld/ldelfgen.c b/ld/ldelfgen.c index 8e84b7a5b3f..34e0351729d 100644 --- a/ld/ldelfgen.c +++ b/ld/ldelfgen.c @@ -304,9 +304,8 @@ ldelf_map_segments (bool need_layout) previous linker generated program headers. */ if (lang_phdr_list == NULL) elf_seg_map (link_info.output_bfd) = NULL; - if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd, - &link_info, - &need_layout)) + if (!bfd_elf_map_sections_to_segments (link_info.output_bfd, + &link_info, &need_layout)) fatal (_("%P: map sections to segments failed: %E\n")); if (phdr_size != elf_program_header_size (link_info.output_bfd)) @@ -384,13 +383,13 @@ ldelf_ctf_strtab_iter_cb (uint32_t *offset, void *arg_) a nonzero refcount. */ do { - if (arg->next_i >= _bfd_elf_strtab_len (arg->strtab)) + if (arg->next_i >= bfd_elf_strtab_len (arg->strtab)) { arg->next_i = 0; return NULL; } - ret = _bfd_elf_strtab_str (arg->strtab, arg->next_i++, &off); + ret = bfd_elf_strtab_str (arg->strtab, arg->next_i++, &off); } while (ret == NULL); diff --git a/ld/ldlang.c b/ld/ldlang.c index 3c57bf7541c..53bbff1f2a6 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -6536,7 +6536,7 @@ lang_size_sections_1 return dot; } -/* Callback routine that is used in _bfd_elf_map_sections_to_segments. +/* Callback routine that is used in bfd_elf_map_sections_to_segments. The BFD library has set NEW_SEGMENT to TRUE iff it thinks that CURRENT_SECTION and PREVIOUS_SECTION ought to be placed into different segments. We are allowed an opportunity to override this decision. */