aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2020-01-22 07:58:48 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2020-01-22 07:58:48 +0000
commitc9c0b66f9ae4b31431c661bd07c1a835d1ebf02a (patch)
tree09b0ca6d60b426accff7404da8ccfe92485d5010 /Makefile
parente5eaf885cc656153c0225138cc2426f398e328ee (diff)
parent641f16e75648d5cad3b21ce7c744bb7a2bc5a729 (diff)
downloadplatform_external_arm-trusted-firmware-c9c0b66f9ae4b31431c661bd07c1a835d1ebf02a.tar.gz
platform_external_arm-trusted-firmware-c9c0b66f9ae4b31431c661bd07c1a835d1ebf02a.tar.bz2
platform_external_arm-trusted-firmware-c9c0b66f9ae4b31431c661bd07c1a835d1ebf02a.zip
Merge "Set lld as the default linker for Clang builds" into integration
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index a25845ee9..c740993f4 100644
--- a/Makefile
+++ b/Makefile
@@ -209,7 +209,10 @@ PP = $(CC) -E $(TF_CFLAGS_$(ARCH))
else ifneq ($(findstring clang,$(notdir $(CC))),)
TF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive)
TF_CFLAGS_aarch64 = -target aarch64-elf $(march64-directive)
-LD = $(LINKER)
+LD = ld.lld
+ifeq (, $(shell which $(LD)))
+$(error "No $(LD) in PATH, make sure it is installed or set LD to a different linker")
+endif
AS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH))
CPP = $(CC) -E
PP = $(CC) -E
@@ -317,10 +320,13 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
TF_LDFLAGS += --remove --info=unused,unusedsymbols
TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH))
+
+# LD = gcc (used when GCC LTO is enabled)
else ifneq ($(findstring gcc,$(notdir $(LD))),)
# Pass ld options with Wl or Xlinker switches
TF_LDFLAGS += -Wl,--fatal-warnings -O1
@@ -337,11 +343,17 @@ ifneq (${ERRATA_A53_843419},1)
endif
TF_LDFLAGS += -nostdlib
TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
+
+# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
TF_LDFLAGS += --fatal-warnings -O1
TF_LDFLAGS += --gc-sections
+# ld.lld doesn't recognize the errata flags,
+# therefore don't add those in that case
+ifeq ($(findstring ld.lld,$(notdir $(LD))),)
TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH))
endif
+endif
DTC_FLAGS += -I dts -O dtb
DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef -x assembler-with-cpp