Remove check_relocs_after_open_input

Message ID afSgoPLa-UtUb1_j@squeak.grove.modra.org
State New
Headers
Series Remove check_relocs_after_open_input |

Commit Message

Alan Modra May 1, 2026, 12:46 p.m. UTC
  After commit 5c3261b0e834 there was no need for this flag.  Remove it
and tidy places that used it.

include/
	* bfdlink.h (struct bfd_link_info): Delete
	check_relocs_after_open_input.
ld/
	* emultempl/aarch64elf.em (before_parse): Don't set
	link_info.check_relocs_after_open_input.
	* emultempl/armelf.em (before_parse): Likewise.
	* emultempl/elf.em (before_parse): Likewise.
	* emultempl/scoreelf.em (before_parse): Likewise.
	* emultempl/mmix-elfnmmo.em (mmix_before_parse): Delete.
	(LDEMUL_BEFORE_PARSE): Don't define.
	* emultempl/mmixelf.em (elfmmix_before_parse): Call elf.em
	before_parse.
	* ldlang.c (lang_check_relocs): Don't test
	link_info.check_relocs_after_open_input.
  

Patch

diff --git a/include/bfdlink.h b/include/bfdlink.h
index a412f9c241a..90b5d8a8d85 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -572,10 +572,6 @@  struct bfd_link_info
   /* TRUE if program headers ought to be loaded.  */
   unsigned int load_phdrs: 1;
 
-  /* TRUE if we should check relocations after all input files have
-     been opened.  */
-  unsigned int check_relocs_after_open_input: 1;
-
   /* TRUE if generation of .interp/PT_INTERP should be suppressed.  */
   unsigned int nointerp: 1;
 
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index 010dbbfaed2..54177249f24 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -59,7 +59,6 @@  gld${EMULATION_NAME}_before_parse (void)
   input_flags.dynamic = ${DYNAMIC_LINK-true};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
-  link_info.check_relocs_after_open_input = true;
 EOF
 if test -n "$COMMONPAGESIZE"; then
 fragment <<EOF
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index a17d6136a2b..c743c6f80d4 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -59,7 +59,6 @@  gld${EMULATION_NAME}_before_parse (void)
   input_flags.dynamic = ${DYNAMIC_LINK-true};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
-  link_info.check_relocs_after_open_input = true;
 EOF
 if test -n "$COMMONPAGESIZE"; then
 fragment <<EOF
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
index 37bdfff051c..9fcf9fa154d 100644
--- a/ld/emultempl/elf.em
+++ b/ld/emultempl/elf.em
@@ -84,7 +84,6 @@  gld${EMULATION_NAME}_before_parse (void)
   input_flags.dynamic = ${DYNAMIC_LINK-true};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
-  link_info.check_relocs_after_open_input = true;
 EOF
 if test -n "$COMMONPAGESIZE"; then
 fragment <<EOF
diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
index 36b99ecf9c9..c4a501cc530 100644
--- a/ld/emultempl/mmix-elfnmmo.em
+++ b/ld/emultempl/mmix-elfnmmo.em
@@ -25,15 +25,6 @@ 
 fragment <<EOF
 #include "elf/mmix.h"
 
-static void gld${EMULATION_NAME}_before_parse (void);
-
-static void
-mmix_before_parse (void)
-{
-  link_info.check_relocs_after_open_input = true;
-  gld${EMULATION_NAME}_before_parse ();
-}
-
 /* Set up handling of linker-allocated global registers.  */
 
 static void
@@ -117,6 +108,5 @@  mmix_after_allocation (void)
 }
 EOF
 
-LDEMUL_BEFORE_PARSE=mmix_before_parse
 LDEMUL_AFTER_ALLOCATION=mmix_after_allocation
 LDEMUL_BEFORE_ALLOCATION=mmix_before_allocation
diff --git a/ld/emultempl/mmixelf.em b/ld/emultempl/mmixelf.em
index 23515c3fb41..324e8877a6d 100644
--- a/ld/emultempl/mmixelf.em
+++ b/ld/emultempl/mmixelf.em
@@ -29,7 +29,7 @@  fragment <<EOF
 static void
 elfmmix_before_parse (void)
 {
-  mmix_before_parse ();
+  gld${EMULATION_NAME}_before_parse ();
 
   /* Make sure we don't create a demand-paged executable.  Unfortunately
      this isn't changeable with a command-line option.  It makes no
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index ac33bfc3fc7..46082603ef0 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -39,7 +39,6 @@  gld${EMULATION_NAME}_before_parse (void)
   input_flags.dynamic = ${DYNAMIC_LINK-true};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
-  link_info.check_relocs_after_open_input = true;
 EOF
 if test -n "$COMMONPAGESIZE"; then
 fragment <<EOF
diff --git a/ld/ldlang.c b/ld/ldlang.c
index d75f9df4d43..dec3d586671 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -8463,21 +8463,15 @@  lang_add_gc_name (const char *name)
 static void
 lang_check_relocs (void)
 {
-  if (link_info.check_relocs_after_open_input)
-    {
-      bfd *abfd;
-
-      for (abfd = link_info.input_bfds;
-	   abfd != (bfd *) NULL; abfd = abfd->link.next)
-	if (!bfd_link_check_relocs (abfd, &link_info))
-	  {
-	    /* No object output, fail return.  */
-	    config.make_executable = false;
-	    /* Note: we do not abort the loop, but rather
-	       continue the scan in case there are other
-	       bad relocations to report.  */
-	  }
-    }
+  for (bfd *abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
+    if (!bfd_link_check_relocs (abfd, &link_info))
+      {
+	/* No object output, fail return.  */
+	config.make_executable = false;
+	/* Note: we do not abort the loop, but rather
+	   continue the scan in case there are other
+	   bad relocations to report.  */
+      }
 }
 
 /* Look through all output sections looking for places where we can