public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix all linker scripts for older binutils versions (pre-2.16)
Date: Sat, 22 Aug 2009 20:00:21 -0400	[thread overview]
Message-ID: <200908222000.22345.vapier@gentoo.org> (raw)
In-Reply-To: <1250510453-30567-1-git-send-email-wd@denx.de>

On Monday 17 August 2009 08:00:53 Wolfgang Denk wrote:
> --- a/config.mk
> +++ b/config.mk
> @@ -166,11 +166,21 @@ endif
> +# Special flags for CPP when processing the linker script
> +# Linker versions prior to 2.16 don't understand the builting
> +# functions SORT_BY_ALIGNMENT() and SORT_BY_NAME(), so disable these
> +ifeq ($(shell $(LD) -v | \
> +	sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\) .*/[ \1 -lt 2
> ] || [ \2 -lt 16 ] \&\& echo old_ld/p' | \ +	sh),old_ld)
> +LDPPFLAGS += -D'SORT_BY_ALIGNMENT(x)=x' -D'SORT_BY_NAME(x)=x'
> +endif

now that it's in the tree, i took a closer look ... guess i should have 
earlier, but oh well

this check will fail with binutils 3.0+ because of the minor check for 16 
without a corresponding major check.

rather than making it specific to the sort problem, why not generalize it.  
extract the major and minor versions and export them to the preprocessor of 
the linker script.  then the linker script input can use these to handle 
macroing away the SORT_xxx stuff.  if there's concern about duplicating these 
macros, then we can start an asm-generic/u-boot.lds.h for people to include 
and centralize the logic.  and next time there is backwards-compatibility 
issues, it's trivial to support since we have the support structure in place.

the way it's written now causes ld to get executed every time config.mk is 
included.  my current test shows that is like 80 times, or 79 useless runs.  
even if we make this a bit smarter (saving the output in a var and exporting 
it), that cuts things down to like 60 executions.  considering this test is 
only used by the linker script code, why not keep it in the top-level 
Makefile.

stderr is not redirected which means if the linker outputs something to that, 
it can quickly cause a lot of excess noise.
-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/20090822/2d24ec5a/attachment.pgp 

  parent reply	other threads:[~2009-08-23  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17 12:00 [U-Boot] [PATCH] Fix all linker scripts for older binutils versions (pre-2.16) Wolfgang Denk
2009-08-17 19:14 ` Mike Frysinger
2009-08-17 19:31   ` Wolfgang Denk
2009-08-17 20:15     ` Mike Frysinger
2009-08-17 20:24       ` Wolfgang Denk
2009-08-17 20:31         ` Mike Frysinger
2009-08-21 21:14 ` Wolfgang Denk
2009-08-22 23:50 ` [U-Boot] [PATCH] Blackfin: use common code to preprocess linker script Mike Frysinger
2009-08-23 20:25   ` Wolfgang Denk
2009-08-23  0:00 ` Mike Frysinger [this message]
2009-08-23  5:34   ` [U-Boot] [PATCH] Fix all linker scripts for older binutils versions (pre-2.16) Wolfgang Denk
2009-08-23  6:09     ` Mike Frysinger
2009-08-23 19:30       ` Wolfgang Denk
2009-08-23  6:47     ` [U-Boot] [PATCH] start a linker script helper file Mike Frysinger
2009-08-23 20:41       ` Wolfgang Denk

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=200908222000.22345.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox