[PATCH] arm64: Force position-independent veneers
Nathan Chancellor
nathan at kernel.org
Fri Sep 27 06:49:05 PDT 2024
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 at arm.com>
> Reported-by: Marc Zyngier <maz at kernel.org>
> Cc: Ard Biesheuvel <ardb at kernel.org>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Nathan Chancellor <nathan at kernel.org>
> Cc: Nick Desaulniers <ndesaulniers at google.com>
> Cc: Will Deacon <will at kernel.org>
Thanks for the patch!
Reviewed-by: Nathan Chancellor <nathan at kernel.org>
> ---
> 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
>
More information about the linux-arm-kernel
mailing list