diff options
author | Alex Richardson <alexrichardson@google.com> | 2021-12-09 11:43:39 +0000 |
---|---|---|
committer | Alex Richardson <alexrichardson@google.com> | 2023-06-08 07:08:49 -0700 |
commit | 135479c70ec6e4e3384b1bb8433a12e587667d30 (patch) | |
tree | 11bd7d7f8b7407b12e4b0cbaec4599c9a8b43ad3 | |
parent | 8c20e005ca0f6459670f0a7c449cc2988f3e04a6 (diff) | |
download | lk-135479c70ec6e4e3384b1bb8433a12e587667d30.tar.gz |
[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.
-rw-r--r-- | engine.mk | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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)) |