aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <alexrichardson@google.com>2021-12-09 11:23:47 +0000
committerAlex Richardson <alexrichardson@google.com>2023-06-08 07:08:49 -0700
commit8c20e005ca0f6459670f0a7c449cc2988f3e04a6 (patch)
tree63141d9bdd9b62047e6a56713d3efc40128c5df7
parent496e2f4b8c82f30464c3cdfa3c7a65e6e2ac55c2 (diff)
downloadlk-8c20e005ca0f6459670f0a7c449cc2988f3e04a6.tar.gz
[make] Set LINKER_TYPE to lld when building with ld.lld
This will be needed in a follow-up commit to disable linker relaxations for RISC-V since ld.ldd does not support them yet.
-rw-r--r--engine.mk6
1 files changed, 6 insertions, 0 deletions
diff --git a/engine.mk b/engine.mk
index cde3a250..c89d1a2c 100644
--- a/engine.mk
+++ b/engine.mk
@@ -195,6 +195,12 @@ SIZE ?= $(TOOLCHAIN_PREFIX)size
NM ?= $(TOOLCHAIN_PREFIX)nm
STRIP ?= $(TOOLCHAIN_PREFIX)strip
+# Detect whether we are using ld.lld. If we don't detect ld.lld, we assume
+# it's ld.bfd. This check can be refined in the future if we need to handle
+# more cases (e.g. ld.gold).
+LINKER_TYPE := $(shell $(LD) -v 2>&1 | grep -q "LLD" && echo lld || echo bfd)
+$(info LINKER_TYPE=$(LINKER_TYPE))
+
# Now that CC is defined we can check if warning flags are supported and add
# them to GLOBAL_COMPILEFLAGS if they are.
ifeq ($(call is_warning_flag_supported,-Wnonnull-compare),yes)