[binutils-gdb] ld: arm32: fix segfault when linking foreign BFDs [PR32870]

Richard Earnshaw rearnsha@sourceware.org
Wed Jun 11 13:39:01 GMT 2025


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

commit da82701f3123b6cbf36758c06b00f25b62634d52
Author: dongjianqiang (A) <dongjianqiang2@huawei.com>
Date:   Tue Apr 15 09:14:08 2025 +0000

    ld: arm32: fix segfault when linking foreign BFDs [PR32870]
    
    PR ld/32870
    
    The linker may occasionally need to process a BFD that is from a
    non-Arm architecture.  There will not be any Arm-specific tdata in
    that case, so skip such BFDs when looking for iplt information as the
    necessary tdata will not be present.

Diff:
---
 bfd/elf32-arm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 5a87462cb26..c913f2b4c7d 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -18394,6 +18394,9 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
 	  struct arm_local_iplt_info **local_iplt;
 	  unsigned int i, num_syms;
 
+	  if (!is_arm_elf (input_bfd))
+	    continue;
+
 	  local_iplt = elf32_arm_local_iplt (input_bfd);
 	  if (local_iplt != NULL)
 	    {


More information about the Binutils-cvs mailing list