From da82701f3123b6cbf36758c06b00f25b62634d52 Mon Sep 17 00:00:00 2001 From: "dongjianqiang (A)" Date: Tue, 15 Apr 2025 09:14:08 +0000 Subject: [PATCH] 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. --- 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) { -- 2.47.2