]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: Use -mno-relax when using lld linker
authorKhem Raj <raj.khem@gmail.com>
Fri, 14 May 2021 21:37:41 +0000 (14:37 -0700)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 29 May 2021 18:40:16 +0000 (11:40 -0700)
commitd63fcef64ee16b58cfe1779804d1cbe1479c3bd2
tree6493dcde67f2eeb3473eb0e6f30c4096e9e0b658
parent3977f0e853fda8fd88b38f0eca101ca7db040b91
riscv: Use -mno-relax when using lld linker

lld does not implement the RISCV relaxation optimizations like GNU ld
therefore disable it when building with lld, Also pass it to
assembler when using external GNU assembler ( LLVM_IAS != 1 ), this
ensures that relevant assembler option is also enabled along. if these
options are not used then we see following relocations in objects

0000000000000000 R_RISCV_ALIGN     *ABS*+0x0000000000000002

These are then rejected by lld
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: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/Makefile