From c27a619e8d149a3cfee7f2ae50ea762317a76122 Mon Sep 17 00:00:00 2001 From: Dong JianQiang Date: Mon, 14 Apr 2025 11:31:24 +0000 Subject: [PATCH] arm32: fix segfault when linking with LLVMgold.so plugin under LTO When handling the iplt in ARM32, the ld must check whether the input_bfd is in ELF format. If the input is an LLVM Bitcode file, an error will be raised. PR 32870 * elf32-arm.c (elf32_arm_output_arch_local_syms): Check input_bfd --- bfd/elf32-arm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 3b7cee3de1c..3af964ce034 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -18345,6 +18345,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.34.1