]> git.itanic.dy.fi Git - linux-stable/commitdiff
riscv: Hoist linker relaxation disabling logic into Kconfig
authorNathan Chancellor <nathan@kernel.org>
Tue, 5 Dec 2023 23:53:50 +0000 (16:53 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 18 Jan 2024 02:08:26 +0000 (18:08 -0800)
Certain configurations may need to be disabled if linker relaxation is
in use, such as DWARF5 with ld.lld < 18. Hoist the logic of whether or
not linker relaxation is in use into Kconfig so decisions can be made at
configuration time.

Reviewed-by: Fangrui Song <maskray@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20231205-riscv-restrict-dwarf5-llvm-v2-1-aedf00a382ac@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/Kconfig
arch/riscv/Makefile

index 95a2a06acc6a62412894e491c3bfd5d4a161d15b..72be1d8122a3cc37707317cf4b943f0e347152a7 100644 (file)
@@ -181,6 +181,11 @@ config HAVE_SHADOW_CALL_STACK
        # https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769
        depends on $(ld-option,--no-relax-gp)
 
+config RISCV_USE_LINKER_RELAXATION
+       def_bool y
+       # https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985
+       depends on !LD_IS_LLD || LLD_VERSION >= 150000
+
 config ARCH_MMAP_RND_BITS_MIN
        default 18 if 64BIT
        default 8
index a74be78678eb0bcabf3d9571669a125401adb64d..e383aa9e2757891fa1d067b05a69b2fcd3e1e892 100644 (file)
@@ -43,8 +43,7 @@ else
        KBUILD_LDFLAGS += -melf32lriscv
 endif
 
-ifeq ($(CONFIG_LD_IS_LLD),y)
-ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 150000),y)
+ifndef CONFIG_RISCV_USE_LINKER_RELAXATION
        KBUILD_CFLAGS += -mno-relax
        KBUILD_AFLAGS += -mno-relax
 ifndef CONFIG_AS_IS_LLVM
@@ -52,7 +51,6 @@ ifndef CONFIG_AS_IS_LLVM
        KBUILD_AFLAGS += -Wa,-mno-relax
 endif
 endif
-endif
 
 ifeq ($(CONFIG_SHADOW_CALL_STACK),y)
        KBUILD_LDFLAGS += --no-relax-gp