aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRoberto Vargas <roberto.vargas@arm.com>2018-04-13 14:26:47 +0100
committerRoberto Vargas <roberto.vargas@arm.com>2018-07-11 09:22:51 +0100
commit2adee763f1ec8d8ed0663d727c7aabce49c726a0 (patch)
treef0d211e58b2d1f2af857aa4e3df3165604285cc3 /Makefile
parentad92509476ca9c0a675bd484b7dc48ce69cc37fb (diff)
downloadarm-trusted-firmware-2adee763f1ec8d8ed0663d727c7aabce49c726a0.tar.gz
Allow overriding the linker
This patch allows the user to override the value of the LD Makefile variable. This feature can be used to force the use of the new Clang linker. Change-Id: I97ffeb18e48fa75346702a479d7dc1e8abcb3621 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 6 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 180c55842..ed45fa3fc 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,7 @@ CC := ${CROSS_COMPILE}gcc
CPP := ${CROSS_COMPILE}cpp
AS := ${CROSS_COMPILE}gcc
AR := ${CROSS_COMPILE}ar
-LD := ${CROSS_COMPILE}ld
+LINKER := ${CROSS_COMPILE}ld
OC := ${CROSS_COMPILE}objcopy
OD := ${CROSS_COMPILE}objdump
NM := ${CROSS_COMPILE}nm
@@ -128,8 +128,8 @@ DTC := dtc
# Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH).
ifneq ($(strip $(wildcard ${LD}.bfd) \
- $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LD}.bfd))),)
-LD := ${LD}.bfd
+ $(foreach dir,$(subst :, ,${PATH}),$(wildcard ${dir}/${LINKER}.bfd))),)
+LINKER := ${LINKER}.bfd
endif
ifeq (${ARM_ARCH_MAJOR},7)
@@ -143,12 +143,15 @@ endif
ifeq ($(notdir $(CC)),armclang)
TF_CFLAGS_aarch32 = -target arm-arm-none-eabi $(march32-directive)
TF_CFLAGS_aarch64 = -target aarch64-arm-none-eabi -march=armv8-a
+LD = $(LINKER)
else ifneq ($(findstring clang,$(notdir $(CC))),)
TF_CFLAGS_aarch32 = $(target32-directive)
TF_CFLAGS_aarch64 = -target aarch64-elf
+LD = $(LINKER)
else
TF_CFLAGS_aarch32 = $(march32-directive)
TF_CFLAGS_aarch64 = -march=armv8-a
+LD = $(LINKER)
endif
TF_CFLAGS_aarch32 += -mno-unaligned-access