[riscv] Disable linker relaxations when linking with ld.lld
We have to compile RISC-V code with -mno-relax when linking with ld.lld since ld.lld does not yet support RISC-V linker relaxations. Without this change, linking with ld.lld results in many errors such as: `relocation R_RISCV_ALIGN requires unimplemented linker relaxation`. This support was implemented as part of LLVM 15, but to support older versions of ld.lld we add the flag unconditionally for now.
This commit is contained in:
@@ -216,6 +216,14 @@ ARCH_COMPILEFLAGS += -Wno-asm-operand-widths
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),riscv)
|
||||
# ld.lld does not support linker relaxations yet.
|
||||
# TODO: This is no longer true as of LLVM 15, so should add a version check
|
||||
ifeq ($(LINKER_TYPE),lld)
|
||||
ARCH_COMPILEFLAGS += -mno-relax
|
||||
endif
|
||||
endif
|
||||
|
||||
$(info PROJECT = $(PROJECT))
|
||||
$(info PLATFORM = $(PLATFORM))
|
||||
$(info TARGET = $(TARGET))
|
||||
|
||||
Reference in New Issue
Block a user