[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.
This commit is contained in:
Alex Richardson
2021-12-09 11:23:47 +00:00
parent 496e2f4b8c
commit 8c20e005ca

View File

@@ -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)