From patchwork Tue Apr 15 09:14:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "dongjianqiang (A)" X-Patchwork-Id: 110466 X-Patchwork-Delegate: rearnsha@gcc.gnu.org Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 600353857B9F for ; Tue, 15 Apr 2025 09:14:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 600353857B9F X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by sourceware.org (Postfix) with ESMTPS id ECA80385841C for ; Tue, 15 Apr 2025 09:14:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECA80385841C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=huawei.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ECA80385841C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744708453; cv=none; b=srpTqv239jiGl1Zm79I4vtXbaGqM31sAd8koIDjt8T/cJ4zh9igfGxYP8VkAQ/W/u2/ZnZnpnxPCUNW+6n8DyWTaF8zYokt8I144uCtFwbvwJpgHwpVD97gDqG9bWSLoeYZEuBN7m6v9/tbmfvuQ/LHfwrcxIidDjoGzUI4ekoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744708453; c=relaxed/simple; bh=6oYyDtf0qQr/Q3pWh3XeQiRgIhpbGWTLCyI2FdyJ8Lc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eV0RDEBLg/MMWjr9YqJCIbJU7f1fKGr90dHcEG8PeyujYvhjz5DW7pPN/hRF5wpy73quT3vxsMd5yZsPI+pudIyE+JqZ/tCXZvpUejrBD0UzyJBky+7IeQYqTLKOC2LsegdYimKvEvJ/Jj+Ee8IIcCgzORbzeyKPqqQkj9bCnNo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECA80385841C Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4ZcJJr03pgzvWsh; Tue, 15 Apr 2025 17:10:04 +0800 (CST) Received: from dggemv712-chm.china.huawei.com (unknown [10.1.198.32]) by mail.maildlp.com (Postfix) with ESMTPS id 9C03E18047B; Tue, 15 Apr 2025 17:14:09 +0800 (CST) Received: from kwepemn100005.china.huawei.com (7.202.194.108) by dggemv712-chm.china.huawei.com (10.1.198.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 15 Apr 2025 17:14:09 +0800 Received: from kwepemd200023.china.huawei.com (7.221.188.117) by kwepemn100005.china.huawei.com (7.202.194.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 15 Apr 2025 17:14:09 +0800 Received: from kwepemd200023.china.huawei.com ([7.221.188.117]) by kwepemd200023.china.huawei.com ([7.221.188.117]) with mapi id 15.02.1748.010; Tue, 15 Apr 2025 17:14:08 +0800 From: "dongjianqiang (A)" To: "binutils@sourceware.org" CC: "Zhangwen(Esan)" , "Yangjian (Compiler)" , "sam@gentoo.org" Subject: [PATCH] PR32870: ld: arm32: fix segfault when linking with LLVMgold.so plugin under LTO Thread-Topic: [PATCH] PR32870: ld: arm32: fix segfault when linking with LLVMgold.so plugin under LTO Thread-Index: AdutpVJFN9MIJGsoQZWKjLYyH8hDwQAQTG0Q Date: Tue, 15 Apr 2025 09:14:08 +0000 Message-ID: Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.174.179.214] MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org Hi, Proposed patch to PR32870. 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. Any suggestions? Thanks. --- PR 32870 * elf32-arm.c (elf32_arm_output_arch_local_syms): Check input_bfd 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) {