[binutils-gdb] bfd/COFF: mark a function exposed to ld as non-private

Jan Beulich jbeulich@sourceware.org
Fri Nov 21 08:08:09 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0ba884fe9ccdde5982fbd86c5218e4f9d80ded48

commit 0ba884fe9ccdde5982fbd86c5218e4f9d80ded48
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Nov 21 09:05:36 2025 +0100

    bfd/COFF: mark a function exposed to ld as non-private
    
    As a non-private function, _bfd_coff_read_internal_relocs() shouldn't have
    a "_bfd_" prefix, but merely a "bfd_" one. Tidy arguments passed whle at
    it.

Diff:
---
 bfd/coff-arm.c   |  2 +-
 bfd/coff-sh.c    | 15 ++++++---------
 bfd/coffgen.c    | 16 ++++++++--------
 bfd/cofflink.c   |  4 ++--
 bfd/libcoff-in.h |  2 +-
 bfd/libcoff.h    |  2 +-
 bfd/xcofflink.c  | 10 +++++-----
 ld/pdb.c         |  3 +--
 8 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 94faaf640bb..babb1b23a63 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -2060,7 +2060,7 @@ bfd_arm_process_before_allocation (bfd *		   abfd,
 
       /* Load the relocs.  */
       /* FIXME: there may be a storage leak here.  */
-      i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);
+      i = bfd_coff_read_internal_relocs (abfd, sec, true, NULL, false, NULL);
 
       BFD_ASSERT (i != 0);
 
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index 928d13a4d18..a727432d5ce 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -731,10 +731,9 @@ sh_relax_section (bfd *abfd,
 	return false;
     }
 
-  internal_relocs = (_bfd_coff_read_internal_relocs
+  internal_relocs = (bfd_coff_read_internal_relocs
 		     (abfd, sec, link_info->keep_memory,
-		      (bfd_byte *) NULL, false,
-		      (struct internal_reloc *) NULL));
+		      NULL, false, NULL));
   if (internal_relocs == NULL)
     goto error_return;
 
@@ -1374,9 +1373,8 @@ sh_relax_delete_bytes (bfd *abfd,
       /* We always cache the relocs.  Perhaps, if info->keep_memory is
 	 FALSE, we should free them, if we are permitted to, when we
 	 leave sh_coff_relax_section.  */
-      internal_relocs = (_bfd_coff_read_internal_relocs
-			 (abfd, o, true, (bfd_byte *) NULL, false,
-			  (struct internal_reloc *) NULL));
+      internal_relocs = (bfd_coff_read_internal_relocs
+			 (abfd, o, true, NULL, false, NULL));
       if (internal_relocs == NULL)
 	return false;
 
@@ -2940,9 +2938,8 @@ sh_coff_get_relocated_section_contents (bfd *output_bfd,
       if (! _bfd_coff_get_external_symbols (input_bfd))
 	goto error_return;
 
-      internal_relocs = (_bfd_coff_read_internal_relocs
-			 (input_bfd, input_section, false, (bfd_byte *) NULL,
-			  false, (struct internal_reloc *) NULL));
+      internal_relocs = (bfd_coff_read_internal_relocs
+			 (input_bfd, input_section, false, NULL, false, NULL));
       if (internal_relocs == NULL)
 	goto error_return;
 
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index a851a22c22e..ce8d5f77617 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -596,12 +596,12 @@ _bfd_coff_internal_syment_name (bfd *abfd,
    value must be INTERNAL_RELOCS.  The function returns NULL on error.  */
 
 struct internal_reloc *
-_bfd_coff_read_internal_relocs (bfd *abfd,
-				asection *sec,
-				bool cache,
-				bfd_byte *external_relocs,
-				bool require_internal,
-				struct internal_reloc *internal_relocs)
+bfd_coff_read_internal_relocs (bfd *abfd,
+			       asection *sec,
+			       bool cache,
+			       bfd_byte *external_relocs,
+			       bool require_internal,
+			       struct internal_reloc *internal_relocs)
 {
   bfd_size_type relsz;
   bfd_byte *free_external = NULL;
@@ -2872,8 +2872,8 @@ init_reloc_cookie_rels (struct coff_reloc_cookie *cookie,
       return true;
     }
 
-  cookie->rels = _bfd_coff_read_internal_relocs (abfd, sec, false, NULL,
-						 0, NULL);
+  cookie->rels = bfd_coff_read_internal_relocs (abfd, sec, false, NULL,
+						false, NULL);
 
   if (cookie->rels == NULL)
     return false;
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index d1658ac1e89..8fabcf7028a 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -1377,7 +1377,7 @@ mark_relocs (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 	continue;
 
       /* Read in the relocs.  */
-      internal_relocs = _bfd_coff_read_internal_relocs
+      internal_relocs = bfd_coff_read_internal_relocs
 	(input_bfd, a, false,
 	 flaginfo->external_relocs,
 	 bfd_link_relocatable (flaginfo->info),
@@ -2391,7 +2391,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 
 	  /* Read in the relocs.  */
 	  target_index = o->output_section->target_index;
-	  internal_relocs = (_bfd_coff_read_internal_relocs
+	  internal_relocs = (bfd_coff_read_internal_relocs
 			     (input_bfd, o, false, flaginfo->external_relocs,
 			      bfd_link_relocatable (flaginfo->info),
 			      (bfd_link_relocatable (flaginfo->info)
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 88f5760b542..a415cfeea25 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -622,7 +622,7 @@ extern bool _bfd_coff_link_add_symbols
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 extern bool _bfd_coff_final_link
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
-extern struct internal_reloc *_bfd_coff_read_internal_relocs
+extern struct internal_reloc *bfd_coff_read_internal_relocs
   (bfd *, asection *, bool, bfd_byte *, bool,
    struct internal_reloc *);
 extern bool _bfd_coff_generic_relocate_section
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index d2d550174da..6d25fe97478 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -626,7 +626,7 @@ extern bool _bfd_coff_link_add_symbols
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 extern bool _bfd_coff_final_link
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
-extern struct internal_reloc *_bfd_coff_read_internal_relocs
+extern struct internal_reloc *bfd_coff_read_internal_relocs
   (bfd *, asection *, bool, bfd_byte *, bool,
    struct internal_reloc *);
 extern bool _bfd_coff_generic_relocate_section
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index b50b17fab1c..14936aaf4d5 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -711,7 +711,7 @@ _bfd_xcoff_bfd_link_hash_table_create (bfd *abfd)
 }
 

 /* Read internal relocs for an XCOFF csect.  This is a wrapper around
-   _bfd_coff_read_internal_relocs which tries to take advantage of any
+   bfd_coff_read_internal_relocs which tries to take advantage of any
    relocs which may have been cached for the enclosing section.  */
 
 static struct internal_reloc *
@@ -736,8 +736,8 @@ xcoff_read_internal_relocs (bfd *abfd,
 	  && cache
 	  && enclosing->reloc_count > 0)
 	{
-	  if (_bfd_coff_read_internal_relocs (abfd, enclosing, true,
-					      external_relocs, false, NULL)
+	  if (bfd_coff_read_internal_relocs (abfd, enclosing, true,
+					     external_relocs, false, NULL)
 	      == NULL)
 	    return NULL;
 	}
@@ -760,8 +760,8 @@ xcoff_read_internal_relocs (bfd *abfd,
 	}
     }
 
-  return _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
-					 require_internal, internal_relocs);
+  return bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
+					require_internal, internal_relocs);
 }
 

 /* Split FILENAME into an import path and an import filename,
diff --git a/ld/pdb.c b/ld/pdb.c
index d0d51c7a79a..9785f7bbd11 100644
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -1946,8 +1946,7 @@ handle_debugs_section (asection *s, bfd *mod, struct string_table *strings,
 
       syment_count = obj_raw_syment_count (mod);
 
-      relocs =
-	_bfd_coff_read_internal_relocs (mod, s, false, NULL, true, NULL);
+      relocs = bfd_coff_read_internal_relocs (mod, s, false, NULL, true, NULL);
 
       symbols = xmalloc (sizeof (struct internal_syment) * syment_count);
       sectlist = xmalloc (sizeof (asection *) * syment_count);


More information about the Binutils-cvs mailing list