[PATCH] coff: Ignore corrupt relocation table

H.J. Lu hjl.tools@gmail.com
Thu Sep 18 23:59:14 GMT 2025


Ignore slurp corrupt relocation table to avoid linker crash later.

	PR ld/33455
	* coffcode.h (coff_slurp_reloc_table): Return false for illegal
	symbol index.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 bfd/coffcode.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 4a1f4be3773..3dfb31f6b79 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5306,8 +5306,8 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
 		/* xgettext:c-format */
 		(_("%pB: warning: illegal symbol index %ld in relocs"),
 		 abfd, dst.r_symndx);
-	      cache_ptr->sym_ptr_ptr = &bfd_abs_section_ptr->symbol;
-	      ptr = NULL;
+	      /* Ignore corrupt relocation table: PR ld/33455.  */
+	      return false;
 	    }
 	  else
 	    {
-- 
2.51.0



More information about the Binutils mailing list