[U-Boot] [PATCH] Fix all linker scripts for older binutils versions (pre-2.16)

Wolfgang Denk wd at denx.de
Sun Aug 23 07:34:38 CEST 2009


Dear Mike Frysinger,

In message <200908222000.22345.vapier at gentoo.org> you wrote:
>
> 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 +=3D -D'SORT_BY_ALIGNMENT(x)=3Dx' -D'SORT_BY_NAME(x)=3Dx'
> > +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.

Well, the "\1 -lt 2" is the major check, isn't it?

> 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.

Good idea...

> 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.

Patches welcome...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Command, n.:
            Statement presented by a human and accepted by a computer
in such a manner as to make the human feel as if he is in control.


More information about the U-Boot mailing list