Skip to contentSkip to conversation

config: Always use GNU ld

PATCH New Otavio Salvador 3 participants 5 messages Aug 2, 2012 – Aug 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config: Always use GNU ld

From: Khem Raj <[email protected]>

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.

---
 config.mk |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
config.mk +5 -1
index 3dcea6a..c3822a2 100644
@@ -133,7 +133,11 @@ cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
 # Include the make variables (CC, etc...)
 #
 AS	= $(CROSS_COMPILE)as
-LD	= $(CROSS_COMPILE)ld
+
+# Always use GNU ld
+LD	= $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \
+		then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;)
+
 CC	= $(CROSS_COMPILE)gcc
 CPP	= $(CC) -E
 AR	= $(CROSS_COMPILE)ar
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 config: Always use GNU ld

Quoted 11 lines · On Thursday 02 August 2012 12:19:34 Otavio Salvador wrote:

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.

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120802/d3d9c3a3/attachment.pgp>

#2 lore raw

PATCH 1/1 config: Always use GNU ld

Quoted 11 lines · Mike Frysinger
Quoted 10 lines · On Thursday 02 August 2012 12:19:34 Otavio Salvador wrote:

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.

Quoted 4 lines
Quoted 1 line

This way it does not matter what the default ld is.

-mike

Wolfgang, I ended not putting you on CC but I think you're the one who would take this patch, aren't you?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: otavio at ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#3 lore raw

PATCH 1/1 config: Always use GNU ld

Quoted 12 lines · Otavio Salvador
Quoted 11 lines · Mike Frysinger
Quoted 10 lines · On Thursday 02 August 2012 12:19:34 Otavio Salvador wrote:

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.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

This way it does not matter what the default ld is.

-mike

Wolfgang, I ended not putting you on CC but I think you're the one who would take this patch, aren't you?

Ping?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: otavio at ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#4 lore raw

PATCH 1/1 config: Always use GNU ld

In reply to Otavio Salvador

Hi,

Quoted 12 lines · On Thu, 2 Aug 2012 13:19:34 -0300 Otavio Salvador <[email protected]>…

From: Khem Raj <[email protected]>

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.

Quoted 7 lines

This way it does not matter what the default ld is.

---
 config.mk |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

applied to my staging branch, thanks!

Anatolij