summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/u-boot/u-boot/2011.12/0007-config-Always-use-GNU-ld.patch
blob: 64685e3974a1203e24e9fd5002f70aa741fc9d72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From a8dc33253472328f2af04973575f26e9106db1c3 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 21 Dec 2011 08:53:02 -0800
Subject: [PATCH] config: Always use GNU ld

This patch makes sure that we always use the GNU ld. u-boot uses certain
construct e.g. OVERLAY which are not implemented in gold therefore it
always needs GNU ld for linking. It works well if default linker in
toolchain is GNU ld but in some cases we can have gold to be the
default linker and also ship GNU ld but not as default in such cases
its called $(PREFIX)ld.bfd, with this patch we make sure that if
$(PREFIX)ld.bfd exists than we use that for our ld. This way it
does not matter what the default ld is.

Upstream-status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 config.mk |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/config.mk b/config.mk
index ddaa477..139dfa0 100644
--- a/config.mk
+++ b/config.mk
@@ -126,11 +126,13 @@ cc-option = $(strip $(if $(findstring $1,$(CC_OPTIONS)),$1,\
 		$(if $(call cc-option-sys,$1),$1,$2)))
 endif
 
+exists_bfd_ld = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \
+		then echo "$(1)"; else echo "$(2)"; fi; )
 #
 # Include the make variables (CC, etc...)
 #
 AS	= $(CROSS_COMPILE)as
-LD	= $(CROSS_COMPILE)ld
+LD	= $(call exists_bfd_ld, "$(CROSS_COMPILE)ld.bfd", "$(CROSS_COMPILE)ld")
 CC	= $(CROSS_COMPILE)gcc
 CPP	= $(CC) -E
 AR	= $(CROSS_COMPILE)ar
-- 
1.7.9.1