From nobody Mon Feb 9 00:14:04 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D89B264627; Tue, 11 Mar 2025 19:43:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741722238; cv=none; b=XsoFhQZ20NHUO41MAo6QkOnwB58MMZ7U8+WkUVMNOmsW0NWz5AzIf3gJYgK2GqP8u0oZ3KDPZDBQ4zmmZrubbRygLYAdwDuFYthhM5ueAm+qKKnkhQg6yVsukQvcx9PeC4MKaDWGvM16qXovguMqTPB97qReaDb36zsZ833bu5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741722238; c=relaxed/simple; bh=s488wFx5aTMKVQsqgNol6mUlN0cq/CNqyWNbSJffAq8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=npsXJeIOEHC/sI3SpZS022ip9Mtou7fKrXM7F7W4CeCqnJzzxGAWKAggNEc+N2wR9qV0GiGicjsVJVQfv9E/Xw/vLwSL1gDdWmfziwp5PxLyXKYfE6oNOjmiEjU32mjY3lPivLm9O8rIsMVEGTvT79k1tJPMGLt5sIjZPL8BjFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mQhCeqyp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mQhCeqyp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29AAAC4CEEF; Tue, 11 Mar 2025 19:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741722238; bh=s488wFx5aTMKVQsqgNol6mUlN0cq/CNqyWNbSJffAq8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mQhCeqyph82Cg2ZwpYdd1k7nkOUcXAegm3Ck1mJcGRLEmBJoxZ49UGDYQzkmtmlsG 7LUyW1tCtYTR7P6MKuZGulF+m8zAyHNjGUpDZZ9lOC579dX3TuAjU1mTPqe205kY8t 2E+bDZKZ1rwB+fmP0yv3Q6h7v2y/DhDA5g2+88vUYS3y7HGqi00w7aI7xxfBFFZWFl zTFk5D4Wm7EV3xo4vomEbRC3d2s/vi7IiidUjKzXY2kxs5AkMbI6sXBz3kkky4CAo8 78ubUEW5qPeKmEODKZxzdktonaFfsztlHgsf9Qeko+5b/NhuCjxNw1n53rDZyahQ+o pFzCZQ4CFhsMg== From: Nathan Chancellor Date: Tue, 11 Mar 2025 20:43:42 +0100 Subject: [PATCH 1/2] ARM: Require linker to support KEEP within OVERLAY for DCE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-arm-fix-vectors-with-linker-dce-v1-1-ec4c382e3bfd@kernel.org> References: <20250311-arm-fix-vectors-with-linker-dce-v1-0-ec4c382e3bfd@kernel.org> In-Reply-To: <20250311-arm-fix-vectors-with-linker-dce-v1-0-ec4c382e3bfd@kernel.org> To: Russell King Cc: Christian Eggers , Arnd Bergmann , Linus Walleij , Yuntao Liu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2601; i=nathan@kernel.org; h=from:subject:message-id; bh=s488wFx5aTMKVQsqgNol6mUlN0cq/CNqyWNbSJffAq8=; b=owGbwMvMwCUmm602sfCA1DTG02pJDOkXJlV2GovpTBT86pTRJnX/AlvNY7+QFxmeUgf39bjuU U99Ib+uo5SFQYyLQVZMkaX6sepxQ8M5ZxlvnJoEM4eVCWQIAxenAEyE5THD/5jN38IN3Q41PXob WTvl9EcNozk9WYqH/jUurNrRHCs6eyvDP4WwnBQeodO7Dwg3PD9jvPG3zWb2heZtnjazLPbF7bB u4QEA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 ld.lld prior to 21.0.0 does not support using the KEEP keyword within an overlay description, which may be needed to avoid discarding necessary sections within an overlay with '--gc-sections', which can be enabled for the kernel via CONFIG_LD_DEAD_CODE_DATA_ELIMINATION. Disallow CONFIG_LD_DEAD_CODE_DATA_ELIMINATION without support for KEEP within OVERLAY and introduce a macro, OVERLAY_KEEP, that can be used to conditionally add KEEP when it is properly supported to avoid breaking old versions of ld.lld. Cc: stable@vger.kernel.org Link: https://github.com/llvm/llvm-project/commit/381599f1fe973afad3094e55e= c99b1620dba7d8c Signed-off-by: Nathan Chancellor Reviewed-by: Linus Walleij --- arch/arm/Kconfig | 2 +- arch/arm/include/asm/vmlinux.lds.h | 6 ++++++ init/Kconfig | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 835b5f100e92..f3f6b7a33b79 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -121,7 +121,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 if (LD_VERSION >=3D 23600 || LD= _IS_LLD) + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >=3D 23600 || LD= _CAN_USE_KEEP_IN_OVERLAY) select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI select HAVE_OPTPROBES if !THUMB2_KERNEL diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmli= nux.lds.h index d60f6e83a9f7..0f8ef1ed725e 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -34,6 +34,12 @@ #define NOCROSSREFS #endif =20 +#ifdef CONFIG_LD_CAN_USE_KEEP_IN_OVERLAY +#define OVERLAY_KEEP(x) KEEP(x) +#else +#define OVERLAY_KEEP(x) x +#endif + /* Set start/end symbol names to the LMA for the section */ #define ARM_LMA(sym, section) \ sym##_start =3D LOADADDR(section); \ diff --git a/init/Kconfig b/init/Kconfig index d0d021b3fa3b..fc994f5cd5db 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -129,6 +129,11 @@ config CC_HAS_COUNTED_BY # https://github.com/llvm/llvm-project/pull/112636 depends on !(CC_IS_CLANG && CLANG_VERSION < 190103) =20 +config LD_CAN_USE_KEEP_IN_OVERLAY + # ld.lld prior to 21.0.0 did not support KEEP within an overlay descripti= on + # https://github.com/llvm/llvm-project/pull/130661 + def_bool LD_IS_BFD || LLD_VERSION >=3D 210000 + config RUSTC_HAS_COERCE_POINTEE def_bool RUSTC_VERSION >=3D 108400 =20 --=20 2.48.1 From nobody Mon Feb 9 00:14:04 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1807264A6E; Tue, 11 Mar 2025 19:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741722240; cv=none; b=nUy+B7MG9GLA0LhL9JaZpNJmXbYrAjoRAo47PJ2NxUZbETxMMdBDylnlg9I/rx3X+dVXOHhFKBtDC23iNCYDQg3xj1rL3y61qx294yS8xv308udOjpz+MDi1bFyrWnxFNz3pxv02KWCs9pLbPoI6AKl/86GSZYT+8QUaV8n7Shk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741722240; c=relaxed/simple; bh=cNLHeDWhNyuM27QisQzqNRVewktto9osrReTHyq97VA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z4lwlu0luxlymjVUzTGWdlexHyGJzZNt0FTlqXDX/WUyJCgyHKSJlBH6f3dnZJCLaxyW0YJtUvsYIwNk3RtZbqqKxDxFRPutqiYwX6HArmAwKImR8rd8a8JykN5f2gm9xUklxPAeYqEgk5Sfx5GEik6X67ZKVblSdAT9xVS+QM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RUfCh8LF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RUfCh8LF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78599C4CEEB; Tue, 11 Mar 2025 19:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741722240; bh=cNLHeDWhNyuM27QisQzqNRVewktto9osrReTHyq97VA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RUfCh8LFZAR1jrtj67BqPaR1pjNlhFuBgUAd33xLzramO4/RhD8AEmQEBIdvMvjSo xGD+pwSHL++SvRzjowVlHKaIoCJ0FUbTd0+euSY7qtAqYLeFIyqisGI4wrz+ejdRyZ wQsjQIpzEoli4pCT/loUhei80hGmkepKSNxEGM09vV2acQPRz1wObKDYxhg4nu7AUP rHzlNdp4blgcv6t5LfJkAVH+zIySMMQ49U7RSnPvjBP0v+mnqqBGG7UOvfEefwnA8n 2h3h37Cu6OpQ3vEuQpXJpufgYwUt+KgA8IjvrsYcdMLBOrhy0tM2h9qvF40YdXEuqy Ho50mpnsy8Hng== From: Nathan Chancellor Date: Tue, 11 Mar 2025 20:43:43 +0100 Subject: [PATCH 2/2] ARM: add KEEP() keyword to ARM_VECTORS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-arm-fix-vectors-with-linker-dce-v1-2-ec4c382e3bfd@kernel.org> References: <20250311-arm-fix-vectors-with-linker-dce-v1-0-ec4c382e3bfd@kernel.org> In-Reply-To: <20250311-arm-fix-vectors-with-linker-dce-v1-0-ec4c382e3bfd@kernel.org> To: Russell King Cc: Christian Eggers , Arnd Bergmann , Linus Walleij , Yuntao Liu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1474; i=nathan@kernel.org; h=from:subject:message-id; bh=k6KErdk8UAE5TaS8j5kgByd6cy02OSxvuL6oLJYcWN8=; b=owGbwMvMwCUmm602sfCA1DTG02pJDOkXJlWmLj/rWPU569kZZ8NOjq9mmuvOy6dP1zrzJzfJ2 GJuhSpTRykLgxgXg6yYIkv1Y9XjhoZzzjLeODUJZg4rE8gQBi5OAZjIvMsM/wuTIu94La9+fE1B Zfob1eNpEQ5JKtozw4PKGxaVqZz5oM3IcKfYh0GqM1Kv4M7Fyr9fdVL9so0+LdlTYiT8eEv99Hp FNgA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 From: Christian Eggers Without this, the vectors are removed if LD_DEAD_CODE_DATA_ELIMINATION is enabled. At startup, the CPU (silently) hangs in the undefined instruction exception as soon as the first timer interrupt arrives. On my setup, the system also boots fine without the 2nd and 3rd KEEP() statements, so I cannot tell whether these are actually required. Cc: stable@vger.kernel.org Fixes: ed0f94102251 ("ARM: 9404/1: arm32: enable HAVE_LD_DEAD_CODE_DATA_ELI= MINATION") Signed-off-by: Christian Eggers [nathan: Use OVERLAY_KEEP() to avoid breaking old ld.lld versions] Signed-off-by: Nathan Chancellor Reviewed-by: Linus Walleij --- arch/arm/include/asm/vmlinux.lds.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmli= nux.lds.h index 0f8ef1ed725e..14811b4f48ec 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -131,13 +131,13 @@ __vectors_lma =3D .; \ OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \ .vectors { \ - *(.vectors) \ + OVERLAY_KEEP(*(.vectors)) \ } \ .vectors.bhb.loop8 { \ - *(.vectors.bhb.loop8) \ + OVERLAY_KEEP(*(.vectors.bhb.loop8)) \ } \ .vectors.bhb.bpiall { \ - *(.vectors.bhb.bpiall) \ + OVERLAY_KEEP(*(.vectors.bhb.bpiall)) \ } \ } \ ARM_LMA(__vectors, .vectors); \ --=20 2.48.1