Skip to contentSkip to conversation

FAILED: patch "[PATCH] ARM: 9443/1: Require linker to support KEEP within OVERLAY" failed to apply to 6.13-stable tree

PATCH [email protected] 3 participants 4 messages Apr 8, 2025 – Apr 10, 2025

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.13-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.13.y
git checkout FETCH_HEAD
git cherry-pick -x e7607f7d6d81af71dcc5171278aadccc94d277cd
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025040805-boaster-hazing-36c3@gregkh' --subject-prefix 'PATCH 6.13.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From e7607f7d6d81af71dcc5171278aadccc94d277cd Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <[email protected]>
Date: Thu, 20 Mar 2025 22:33:49 +0100
Subject: [PATCH] ARM: 9443/1: Require linker to support KEEP within OVERLAY
for DCE

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.

arch/arm/Kconfig +1 -1
index 202dbd17ad2f..25ed6f1a7c7a 100644
@@ -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 >= 23600 || LD_IS_LLD)
+	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >= 23600 || LD_CAN_USE_KEEP_IN_OVERLAY)
 	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_NMI
 	select HAVE_OPTPROBES if !THUMB2_KERNEL
arch/arm/include/asm/vmlinux.lds.h +6 -0
index 89697f204715..a54db342653a 100644
@@ -34,6 +34,12 @@
 #define NOCROSSREFS
 #endif
 
+#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 = LOADADDR(section);				\
init/Kconfig +5 -0
index d0d021b3fa3b..fc994f5cd5db 100644
@@ -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)
 
+config LD_CAN_USE_KEEP_IN_OVERLAY
+	# ld.lld prior to 21.0.0 did not support KEEP within an overlay description
+	# https://github.com/llvm/llvm-project/pull/130661
+	def_bool LD_IS_BFD || LLD_VERSION >= 210000
+
 config RUSTC_HAS_COERCE_POINTEE
 	def_bool RUSTC_VERSION >= 108400
 
Reviewed-by Linus Walleij
#1 lore raw

On Tue, Apr 08, 2025 at 11:15:05AM +0200, [email protected] wrote:
...

Quoted 7 lines

------------------ original commit in Linus's tree ------------------

From e7607f7d6d81af71dcc5171278aadccc94d277cd Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <[email protected]>
Date: Thu, 20 Mar 2025 22:33:49 +0100
Subject: [PATCH] ARM: 9443/1: Require linker to support KEEP within OVERLAY
for DCE

Attached is a backport for 6.12 and 6.13. This change is necessary for "ARM: 9444/1: add KEEP() keyword to ARM_VECTORS", as pointed out at
https://lore.kernel.org/[email protected]/.

Cheers,
Nathan

From 4800091d0ce47de62d584cda0c4c4eb2eedbe794 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <[email protected]>
Date: Thu, 20 Mar 2025 22:33:49 +0100
Subject: [PATCH 6.12 and 6.13] ARM: 9443/1: Require linker to support KEEP
within OVERLAY for DCE

commit e7607f7d6d81af71dcc5171278aadccc94d277cd upstream.

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.

---
 arch/arm/Kconfig                   | 2 +-
 arch/arm/include/asm/vmlinux.lds.h | 6 ++++++
 init/Kconfig                       | 5 +++++
 3 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 202397be76d8..d0040fb67c36 100644
@@ -118,7 +118,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 >= 23600 || LD_IS_LLD)
+	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >= 23600 || LD_CAN_USE_KEEP_IN_OVERLAY)
 	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_NMI
 	select HAVE_OPTPROBES if !THUMB2_KERNEL
arch/arm/include/asm/vmlinux.lds.h +6 -0
index d60f6e83a9f7..0f8ef1ed725e 100644
@@ -34,6 +34,12 @@
 #define NOCROSSREFS
 #endif
 
+#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 = LOADADDR(section);				\
init/Kconfig +5 -0
index 4c88cb58c261..f3dbdec0a04e 100644
@@ -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)
 
+config LD_CAN_USE_KEEP_IN_OVERLAY
+	# ld.lld prior to 21.0.0 did not support KEEP within an overlay description
+	# https://github.com/llvm/llvm-project/pull/130661
+	def_bool LD_IS_BFD || LLD_VERSION >= 210000
+
 config PAHOLE_VERSION
 	int
 	default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))

base-commit: 1edf71b4b7d9f599843d2c5280537d10be495ebc

Signature · 1 line
2.49.0
author maintainer
#2 lore raw
Quoted 10 lines · Nathan Chancellor

On Tue, Apr 08, 2025 at 11:15:05AM +0200, [email protected] wrote:
...

Quoted 7 lines

------------------ original commit in Linus's tree ------------------

From e7607f7d6d81af71dcc5171278aadccc94d277cd Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <[email protected]>
Date: Thu, 20 Mar 2025 22:33:49 +0100
Subject: [PATCH] ARM: 9443/1: Require linker to support KEEP within OVERLAY
for DCE

Quoted 3 lines

Attached is a backport for 6.12 and 6.13. This change is necessary for "ARM: 9444/1: add KEEP() keyword to ARM_VECTORS", as pointed out at
https://lore.kernel.org/[email protected]/.

Thanks, now queued up.

greg k-h

maintainer Reviewed-by Linus Walleij
#3 lore raw
In reply to Nathan Chancellor

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: e7607f7d6d81af71dcc5171278aadccc94d277cd

Status in newer kernel trees:
6.14.y | Present (different SHA1: 9309361bbaee)

Note: The patch differs from the upstream commit:
---
1: e7607f7d6d81a ! 1: c49dffd98b600 ARM: 9443/1: Require linker to support KEEP within OVERLAY for DCE
@@ Metadata
Author: Nathan Chancellor <[email protected]>

## Commit message ##
- ARM: 9443/1: Require linker to support KEEP within OVERLAY for DCE
+ FAILED: patch "[PATCH] ARM: 9443/1: Require linker to support KEEP within OVERLAY" failed to apply to 6.13-stable tree
+
+ On Tue, Apr 08, 2025 at 11:15:05AM +0200, [email protected] wrote:
+ ...
+ > ------------------ original commit in Linus's tree ------------------
+ >
+ > From e7607f7d6d81af71dcc5171278aadccc94d277cd Mon Sep 17 00:00:00 2001
+ > From: Nathan Chancellor <[email protected]>
+ > Date: Thu, 20 Mar 2025 22:33:49 +0100
+ > Subject: [PATCH] ARM: 9443/1: Require linker to support KEEP within OVERLAY
+ > for DCE
+
+ Attached is a backport for 6.12 and 6.13. This change is necessary for
+ "ARM: 9444/1: add KEEP() keyword to ARM_VECTORS", as pointed out at
+ https://lore.kernel.org/[email protected]/.
+
+ Cheers,
+ Nathan
+
+ From 4800091d0ce47de62d584cda0c4c4eb2eedbe794 Mon Sep 17 00:00:00 2001
+ From: Nathan Chancellor <[email protected]>
+ Date: Thu, 20 Mar 2025 22:33:49 +0100
+ Subject: [PATCH 6.12 and 6.13] ARM: 9443/1: Require linker to support KEEP
+ within OVERLAY for DCE
+
+ commit e7607f7d6d81af71dcc5171278aadccc94d277cd upstream.

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
@@ Commit message

+ [nathan: Fix conflict in init/Kconfig due to lack of RUSTC symbols]
+ Signed-off-by: Nathan Chancellor <[email protected]>

## arch/arm/Kconfig ##
@@ arch/arm/Kconfig: config ARM
@@ init/Kconfig: config CC_HAS_COUNTED_BY
+ # https://github.com/llvm/llvm-project/pull/130661
+ def_bool LD_IS_BFD || LLD_VERSION >= 210000
+
- config RUSTC_HAS_COERCE_POINTEE
- def_bool RUSTC_VERSION >= 108400
-
+ config PAHOLE_VERSION
+ int
+ default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.13.y       |  Success    |  Success   |