All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] common: Link with GCC instead of LD
Date: Wed, 31 Oct 2012 20:51:44 +0100	[thread overview]
Message-ID: <50918150.1030202@googlemail.com> (raw)
In-Reply-To: <1351701168-7293-1-git-send-email-marex@denx.de>

Dear Marek Vasut,

On 31.10.12 17:32, Marek Vasut wrote:
> Flip over from linking with LD to linking with GCC. This has some
> long-term benefits, like easy path to enabling LTO.
> 
> Most of this patch is about passing parameters to the linker invoked
> by GCC at the linking stage. This involves prefixing most of these with
> -Wl,<param> . A few more adjustments had to be made though.
> 
> The LDFLAGS had to be extended by --build-id=none to prevent generation
> of the .note.gnu.build-id section, which contains unique build-id we
> don't care about. Moreover -nostdlib had to be added to LDFLAGS to link
> properly without pulling in GCC libs during partial link.
> 
> The LDFLAGS_FINAL had to be augmented by -Wl,-allow-multiple-definition
> to prevent GCC from complaining about multiple definitions of the register
> containing global data.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: Tom Rini <trini@ti.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---

> 
> NOTE: It should mostly work, but _PLEASE_ test it properly. I definitelly
>       can not run it on most of the affected platforms. Besides, it might
>       still hit some build issues, it's not properly compiler-tested. Any
>       additional fixes are welcome ;-)
> 
> NOTE: I detected code size being smaller by a few bytes, but then it might
>       cause breakage, so I'd be really cautious here.
> 

<snip>

> diff --git a/config.mk b/config.mk
> index b7cd481..ec8cd6b 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -137,9 +137,8 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
>  #
>  AS	= $(CROSS_COMPILE)as
>  
> -# 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;)
> +# Link with GCC
> +LD	= $(CROSS_COMPILE)gcc

with this change we should also remove LD_VERSION_STRING from
$(VERSION_FILE). Currently it will call 'gcc -v' which will print
compile switches to stderr.

Compiled and runtime tested on avr32 atngw100mkii, on first sight it
seems sane.

Best regards

Andreas Bie?mann

  reply	other threads:[~2012-10-31 19:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 16:32 [U-Boot] [PATCH] common: Link with GCC instead of LD Marek Vasut
2012-10-31 19:51 ` Andreas Bießmann [this message]
2012-10-31 20:52   ` Marek Vasut
2012-10-31 22:36 ` Wolfgang Denk
2012-10-31 22:48   ` Tom Rini
2012-10-31 23:28     ` Wolfgang Denk
2012-10-31 23:39       ` Tom Rini
2012-10-31 22:51   ` Marek Vasut
2012-10-31 23:32     ` Wolfgang Denk
2012-10-31 23:45       ` Marek Vasut
2012-11-01  0:00         ` Wolfgang Denk
2012-11-01  0:06           ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50918150.1030202@googlemail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.