[PATCH v2 2/2] ARM: avoid that vectors are removed during linker garbage collection

Christian Eggers ceggers at arri.de
Mon Feb 24 04:54:14 PST 2025


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.

Fixes: ed0f94102251 ("ARM: 9404/1: arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION")
Signed-off-by: Christian Eggers <ceggers at arri.de>
---
v2:
- changed patch title

 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/vmlinux.lds.h
index 7ba309f826f9..288057e07e69 100644
--- a/arch/arm/include/asm/vmlinux.lds.h
+++ b/arch/arm/include/asm/vmlinux.lds.h
@@ -126,16 +126,16 @@
 	/* Note: The LLD linker seems not to support marking input */	\
 	/* sections with KEEP() inside a OVERLAY statement */		\
 	.vectors 0xffff0000 : AT (__vectors_lma) {			\
-			*(.vectors)					\
+			KEEP(*(.vectors))				\
 	}								\
 	.vectors.bhb.loop8 0xffff0000 : AT (__vectors_lma +		\
 		SIZEOF(.vectors)) {					\
-			*(.vectors.bhb.loop8)				\
+			KEEP(*(.vectors.bhb.loop8))			\
 	}								\
 	.vectors.bhb.bpiall 0xffff0000 : AT (__vectors_lma +		\
 		SIZEOF(.vectors) +					\
 		SIZEOF(.vectors.bhb.loop8)) {				\
-			*(.vectors.bhb.bpiall)				\
+			KEEP(*(.vectors.bhb.bpiall))			\
 	}								\
 	ARM_LMA(__vectors, .vectors);					\
 	ARM_LMA(__vectors_bhb_loop8, .vectors.bhb.loop8);		\
-- 
2.43.0




More information about the linux-arm-kernel mailing list