Commit 3cebf80e authored by Fangrui Song's avatar Fangrui Song Committed by Palmer Dabbelt

riscv: Pass -mno-relax only on lld < 15.0.0

lld since llvm:6611d58f5bbc ("[ELF] Relax R_RISCV_ALIGN"), which will be
included in the 15.0.0 release, has implemented some RISC-V linker
relaxation.  -mno-relax is no longer needed in
KBUILD_CFLAGS/KBUILD_AFLAGS to suppress R_RISCV_ALIGN which older lld
can not handle:

    ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN
    requires unimplemented linker relaxation; recompile with -mno-relax
    but the .o is already compiled with -mno-relax
Signed-off-by: default avatarFangrui Song <maskray@google.com>
Link: https://lore.kernel.org/r/20220710071117.446112-1-maskray@google.com/
Link: https://lore.kernel.org/r/20220918092933.19943-1-palmer@rivosinc.comReviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Tested-by: default avatarConor Dooley <conor.dooley@microchip.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent f2913d00
...@@ -37,6 +37,7 @@ else ...@@ -37,6 +37,7 @@ else
endif endif
ifeq ($(CONFIG_LD_IS_LLD),y) ifeq ($(CONFIG_LD_IS_LLD),y)
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0)
KBUILD_CFLAGS += -mno-relax KBUILD_CFLAGS += -mno-relax
KBUILD_AFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax
ifndef CONFIG_AS_IS_LLVM ifndef CONFIG_AS_IS_LLVM
...@@ -44,6 +45,7 @@ ifndef CONFIG_AS_IS_LLVM ...@@ -44,6 +45,7 @@ ifndef CONFIG_AS_IS_LLVM
KBUILD_AFLAGS += -Wa,-mno-relax KBUILD_AFLAGS += -Wa,-mno-relax
endif endif
endif endif
endif
# ISA string setting # ISA string setting
riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment