From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4F43C52D7C for ; Mon, 12 Aug 2024 07:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1z3ARtVF1s4UZ4JEYCZ6xJziJ0obK5gkoF7QAQAYKO4=; b=Ylgnuitq7Ns9Q2lKB/y3lJncVZ 3yaSl4Wv55hZwQbQMNc5FjVeVAM9OADq3SUDNaFEm41BN6BTCj6eF4CqINk6z4ILLTfvtGxDu6cd4 9/j5lunnA48TvDLLFu76cu3IRwKBzFAxNXky2xcaB5s1RrjFmK3OmMiCnBj52kCqJjzmHaIkJyM3R F2SLh8GpuhkEAP9IJpyR80vpcdKRTSjfAtM5/dWo0YVU181WsfZW8Er7LMyVu9Jy2QqQKboTelCNS 4xHDdcJ2uFGrC71xPKw08s/EZVI0/MCb5mrNG0o/qP5Hr4YKccIfzwk3DGXR+VStowwEinOFTEMuO cTm/U/cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdPr7-0000000HD8k-3BqE; Mon, 12 Aug 2024 07:52:41 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdPqX-0000000HD2c-0ssT for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 07:52:06 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-7c3e0a3c444so772041a12.1 for ; Mon, 12 Aug 2024 00:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723449124; x=1724053924; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1z3ARtVF1s4UZ4JEYCZ6xJziJ0obK5gkoF7QAQAYKO4=; b=El4sfaNEZRb4+a9g8JDL2sYVwpL4VWBvu0gN1SUOm6PhOEImMQQngmSuoD52kd2pTq aFdvo5pHD23D5ZlZnmCQVvv2zTJf/rJD6xUwflLZOr/OA+Ggm3aAkFbc6dmsSy27Q9aJ gfuw+tP+t5SnwI45cgi8IwSgFK8jufrUu4N78/XvikTYupza96cAFHtaS/+kJz9B2HCO xsEy69tmrtfthJrziSI97Nkxq51RoLwSj2Iyw0Jt1Gdd8B7sJfj6y1NwBKYgXQ614W5Y 7WfPDi5CIP6EZk0vvBifYlzcGwHqhG/LPbq5rLwsumxG4RR2OHnSxP1Qpzu9Q2pO/su8 FJfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723449124; x=1724053924; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1z3ARtVF1s4UZ4JEYCZ6xJziJ0obK5gkoF7QAQAYKO4=; b=n7LnV6KaHrujsnmhDcGmvAi8BtvO7ghZQXMFxhWnnXL+SH28cxVVfisOTtaG7yMBri 33bIPJ3Jp5rlLZ9HQMaRevQw75zePnn59pxkYXHWuVMN40xttBtLu9tmWXTQAaKPRv5V w7qbogcQf6LQBvGdjIvHqJOcjeFDxJBiQarg5Tl7MDBUouoA5OZ1KaJdzgTW/GkjtHO0 yEzCc6DVNZg+jk/GbGR5T1b78sJVRNW16rbisfmous0tlwZ39w3P7YroochQp+2aXu5x KAJ9CLyRY+RP8PmlyGdeTCT3ksesYc50VdFzsqlDQl8CZ4ILjVAazG5sZe/fu9LKXlPu ZN/Q== X-Forwarded-Encrypted: i=1; AJvYcCX2RMgubCWORTbL3itOtN0L84N6VKRTDo5QlQgIVFvqEi8xm5AvQrt7ps/ZnITmvOr0cooqimzVCsRByuE5hZamRh5BRAnAqfqgA7BS6Mmy9/Rzfo4= X-Gm-Message-State: AOJu0YzHwTmtl3owM7HLfY3T52WBr6ULIzDV+a+cClcKLwhXuaWbjFSB M1UbJr3ffyvPkiKZOmrmBB6mjx3GHNgBrcqSsHfrzt8TL2e7eNaq X-Google-Smtp-Source: AGHT+IFuelHarYbffc12CY6NeWA8NXio7SB6aNddRYPabfcsug7V494DrC8qOoHcxRuTQyT6eo9j1Q== X-Received: by 2002:a17:902:e749:b0:1fd:6581:93c5 with SMTP id d9443c01a7336-20096ba9cafmr199479375ad.27.1723449123890; Mon, 12 Aug 2024 00:52:03 -0700 (PDT) Received: from [192.168.10.4] ([43.224.156.12]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7c68b770c98sm608669a12.37.2024.08.12.00.52.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Aug 2024 00:52:03 -0700 (PDT) Message-ID: <54f87fcb-74da-4b48-a12e-4c7d9fa2870e@gmail.com> Date: Mon, 12 Aug 2024 13:21:59 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] arm: Fix build issue with LD_DEAD_CODE_DATA_ELIMINATION Content-Language: en-GB To: Yuntao Liu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linux@armlinux.org.uk, arnd@arndb.de, afd@ti.com, rmk+kernel@armlinux.org.uk, linus.walleij@linaro.org, akpm@linux-foundation.org, eric.devolder@oracle.com, masahiroy@kernel.org References: <20240808123556.681609-1-liuyuntao12@huawei.com> From: Harith George In-Reply-To: <20240808123556.681609-1-liuyuntao12@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_005205_304985_89400E82 X-CRM114-Status: GOOD ( 19.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08-08-2024 18:05, Yuntao Liu wrote: > There is a build issue with LD segmentation fault, while > CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is not enabled, as bellow. > > scripts/link-vmlinux.sh: line 49: 3796 Segmentation fault > (core dumped) ${ld} ${ldflags} -o ${output} ${wl}--whole-archive > ${objs} ${wl}--no-whole-archive ${wl}--start-group > ${libs} ${wl}--end-group ${kallsymso} ${btf_vmlinux_bin_o} ${ldlibs} > > The error occurs in older versions of the GNU ld with version earlier > than 2.36. It makes most sense to have a minimum LD version as > a dependency for HAVE_LD_DEAD_CODE_DATA_ELIMINATION and eliminate > the impact of ".reloc .text, R_ARM_NONE, ." when > CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is not enabled. > > Fixes: ed0f94102251 ("ARM: 9404/1: arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION") > Reported-by: Harith George > Suggested-by: Arnd Bergmann > Signed-off-by: Yuntao Liu > Link: https://lore.kernel.org/all/14e9aefb-88d1-4eee-8288-ef15d4a9b059@gmail.com/ > --- > arch/arm/Kconfig | 2 +- > arch/arm/kernel/entry-armv.S | 12 +++++++++--- > 2 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index 54b2bb817a7f..173159e93c99 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -117,7 +117,7 @@ config ARM > select HAVE_KERNEL_XZ > select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M > select HAVE_KRETPROBES if HAVE_KPROBES > - select HAVE_LD_DEAD_CODE_DATA_ELIMINATION > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >= 23600 || LD_IS_LLD) > select HAVE_MOD_ARCH_SPECIFIC > select HAVE_NMI > select HAVE_OPTPROBES if !THUMB2_KERNEL > diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S > index f01d23a220e6..cd443faf8645 100644 > --- a/arch/arm/kernel/entry-armv.S > +++ b/arch/arm/kernel/entry-armv.S > @@ -29,6 +29,12 @@ > #include "entry-header.S" > #include > > +#ifdef CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION > +#define RELOC_TEXT_NONE (.reloc .text, R_ARM_NONE, .) > +#else > +#define RELOC_TEXT_NONE > +#endif > + > /* > * Interrupt handling. > */ > @@ -1065,7 +1071,7 @@ vector_addrexcptn: > .globl vector_fiq > > .section .vectors, "ax", %progbits > - .reloc .text, R_ARM_NONE, . > + RELOC_TEXT_NONE > W(b) vector_rst > W(b) vector_und > ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_swi ) > @@ -1079,7 +1085,7 @@ THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_swi ) > > #ifdef CONFIG_HARDEN_BRANCH_HISTORY > .section .vectors.bhb.loop8, "ax", %progbits > - .reloc .text, R_ARM_NONE, . > + RELOC_TEXT_NONE > W(b) vector_rst > W(b) vector_bhb_loop8_und > ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_loop8_swi ) > @@ -1092,7 +1098,7 @@ THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_bhb_loop8_swi ) > W(b) vector_bhb_loop8_fiq > > .section .vectors.bhb.bpiall, "ax", %progbits > - .reloc .text, R_ARM_NONE, . > + RELOC_TEXT_NONE > W(b) vector_rst > W(b) vector_bhb_bpiall_und > ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_bpiall_swi ) Build tested. Solves the earlier build issue I was seeing. fwiw, you can add my tested by tag if needed. Tested-by: Harith George