[Gta04-owner] [PATCH] config: Always use GNU ld

Dr. H. Nikolaus Schaller hns at goldelico.com
Sat Jun 8 12:15:24 CEST 2013


Hi Lukas,

Am 07.06.2013 um 21:36 schrieb Lukas Märdian:

> Hi,
> the following patch fixes the build of the GTA04 u-boot on toolchains
> which do not use the default GNU-ld but e.g. gold.
> 
> With this patch applied I can build u-boot according to:
>  http://projects.goldelico.com/p/gta04-uboot/page/Build/
> 
> BR,
>  Lukas

Thanks for this suggestion!
it did apply fine to the GTA04 tree and I did not see any side-effect on a GNU-only-ld build.
Nikolaus


Am 07.06.2013 um 21:36 schrieb Lukas Märdian:

> From: Khem Raj <raj.khem at gmail.com>
> 
> 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 at gmail.com>
> ---
> u-boot/config.mk |    4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/u-boot/config.mk b/u-boot/config.mk
> index bf1cdc4..264b91d 100644
> --- a/u-boot/config.mk
> +++ b/u-boot/config.mk
> @@ -99,11 +99,13 @@ HOSTCFLAGS	+= -pedantic
> cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> 		> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
> 
> +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.5
> 
> _______________________________________________
> Gta04-owner mailing list
> Gta04-owner at goldelico.com
> http://lists.goldelico.com/mailman/listinfo/gta04-owner



More information about the Gta04-owner mailing list