Re: [PATCH] arm64: Force position-independent veneers
From: Nathan Chancellor <nathan@kernel.org>
Date: 2024-09-27 13:50:37
On Fri, Sep 27, 2024 at 11:18:38AM +0100, Mark Rutland wrote:
Certain portions of code always need to be position-independent regardless of CONFIG_RELOCATABLE, including code which is executed in an idmap or which is executed before relocations are applied. In some kernel configurations the LLD linker generates position-dependent veneers for such code, and when executed these result in early boot-time failures. Marc Zyngier encountered a boot failure resulting from this when building a (particularly cursed) configuration with LLVM, as he reported to the list:
Heh, I admire the "particularly cursed" bit.
I've tested with GNU LD 2.30 to 2.42 inclusive and LLVM 13.0.1 to 19.1.0 inclusive, using the kernel.org binaries from: * https://mirrors.edge.kernel.org/pub/tools/crosstool/ * https://mirrors.edge.kernel.org/pub/tools/llvm/ Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reported-by: Marc Zyngier <maz@kernel.org> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <redacted> Cc: Will Deacon <will@kernel.org>
Thanks for the patch! Reviewed-by: Nathan Chancellor <nathan@kernel.org>
quoted hunk ↗ jump to hunk
--- arch/arm64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index f6bc3da1ef110..c8e237b20ef29 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile@@ -10,7 +10,7 @@ # # Copyright (C) 1995-2001 by Russell King -LDFLAGS_vmlinux :=--no-undefined -X +LDFLAGS_vmlinux :=--no-undefined -X --pic-veneer ifeq ($(CONFIG_RELOCATABLE), y) # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour-- 2.30.2