summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2018-01-10 15:12:47 -0800
committerJulius Werner <jwerner@chromium.org>2018-01-29 11:07:30 -0800
commitb25a577fda06482d68f6af7b54995c1c417f43e0 (patch)
treee6d1349b44648e2c1f99610e759073350e92612b /Makefile
parent211d307c6bfadbe44aa27998e105436143e1b147 (diff)
Makefile: Use ld.bfd linker if available
Some toolchain distributions install both the BFD and GOLD linkers under the names <target>-ld.bfd and <target>-ld.gold. <target>-ld will then be a symlink that may point to either one of these. Trusted Firmware should always be linked with the BFD linker, since GOLD is meant primarily for userspace programs and doesn't support many of the more obscure linker script features that may be needed for firmware. With this patch the Makefile will auto-detect if ld.bfd is available and use it explicitly in that case. Change-Id: I7017055f67db3bd57d191d20a7af06ca646937d7 Signed-off-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c0fddcf6..60d99bf7 100644
--- a/Makefile
+++ b/Makefile
@@ -126,6 +126,12 @@ OD := ${CROSS_COMPILE}objdump
NM := ${CROSS_COMPILE}nm
PP := ${CROSS_COMPILE}gcc -E
+# 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
+endif
+
ifeq (${ARM_ARCH_MAJOR},7)
target32-directive = -target arm-none-eabi
# Will set march32-directive from platform configuration