]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/ELF: mark functions exposed to ld as non-private
authorJan Beulich <jbeulich@suse.com>
Fri, 7 Nov 2025 14:00:25 +0000 (15:00 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 7 Nov 2025 14:00:25 +0000 (15:00 +0100)
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().

bfd/elf-bfd.h
bfd/elf-strtab.c
bfd/elf.c
bfd/elf32-ppc.c
bfd/elflink.c
ld/emultempl/genelf.em
ld/emultempl/loongarchelf.em
ld/ldelf.c
ld/ldelfgen.c
ld/ldlang.c

index 6d55c745837056b242aa42bc5550413260c08024..daad1a938f0401106795ea29b32f29acb40cabaa 100644 (file)
@@ -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
index 9b0b0b8ec60548a85d9c189a651b66adf09698c4..e394064dc5c5f30e53a83d9c37c99b6b028300b6 100644 (file)
@@ -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;
index e6e6a348ecab3579556d24720041845bf6da616e..e2c02440612041ef0124d894f7eb6a24875fc86e 100644 (file)
--- 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;
index 9625ff2a5b7dda274f36f83b5100f87ff2cb0f1a..c549b832b7fb85f4ba8e12c0ceda4c69634eee06 100644 (file)
@@ -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
index 635fdec8bbe6d6ba5bad15a2623caaaa8f9a5302..e2f5425ba3976e6e383b2045594942bd173bf9da 100644 (file)
@@ -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
index b04e046208f6648b6f3b79389e88dfa0b5979abb..992888dd45a0b802d4b945209f1f3cb7a83e199b 100644 (file)
@@ -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 ();
 }
index 517ece1610544beabba16a82e719372a45ad4812..e86ff5c26718f13e6e498f2da661d76db570c845 100644 (file)
@@ -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"));
     }
 
index f4f27fc3873440398ff85a403e8b98a834e5697c..03b06ac142595e668a306fba98069b507dd40e02 100644 (file)
@@ -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;
index 8e84b7a5b3fcf0488eda8afaf30bb39646d453b9..34e0351729dcde523f14621d56a4f040d097e88b 100644 (file)
@@ -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);
 
index 3c57bf7541cfaacff7eeec6d1ea6f6b0cd2280f4..53bbff1f2a67bec03b14f1b9521708428a6ed301 100644 (file)
@@ -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.  */