]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld: arm32: fix segfault when linking foreign BFDs [PR32870]
authordongjianqiang (A) <dongjianqiang2@huawei.com>
Tue, 15 Apr 2025 09:14:08 +0000 (09:14 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Wed, 11 Jun 2025 13:33:37 +0000 (14:33 +0100)
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.

bfd/elf32-arm.c

index 5a87462cb2662412b7cfd35c55b7dea8342160b3..c913f2b4c7db5c4c433dfeb99b4a713672256f58 100644 (file)
@@ -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)
            {