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

Wolfgang Denk wd at denx.de
Fri Aug 21 23:14:03 CEST 2009


In message <1250510453-30567-1-git-send-email-wd at denx.de> I wrote:
> Commit f62fb99941c6 fixed handling of all rodata sections by using a
> wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT()
> and SORT_BY_NAME().  Unfortunately these functions were only
> introduced with biunutils version 2.16, so the modification broke
> building with all tool chains using older binutils.
> 
> This patch makes it work again.  This is done by omitting the use of
> these functions for such old tool chains.  This will result in
> slightly larger target binaries, as the rodata sections are no longer
> in optimal order alignment-wise which reauls in unused gaps, but the
> effect was found to be insignificant - especially compared to the fact
> that you cannot build U-Boot at all in the current state.
> 
> As ld seems to have no support for conditionals we run the linker
> script through the C preprocessor which can be easily used to remove
> the unwanted function calls.
> 
> Note that the C preprocessor must be run with the "-ansi" (or a
> "-std=") option to make sure all the system-specific predefined
> macros outside the reserved namespace are suppressed. Otherise, cpp
> might for example substitute "powerpc" to "1", thus corrupting for
> example "OUTPUT_ARCH(powerpc)" etc.
> 
> Signed-off-by: Wolfgang Denk <wd at denx.de>
> Cc: Mike Frysinger <vapier at gentoo.org>
> ---
> Compile tested on ARM and PPC, with ELDK 3.1, 3.1.1, 4.1 and 4.2,
> on ARM both with and without USE_PRIVATE_LIBGCC=yes.
> 
> I'm not sure if this is to be considered a bug fix (if you have to
> use an older tool chain, it certainly solves a serious problem of the
> current code) and should go into the current release, or if we should
> rather wait with this for the next version.  Comments welcome.
> 
> 
> Mike, I am aware that Blackfin is already using the C preprocessor to
> generate it's linker scripts. I guess this step can now be folded into
> this general mechanism. Do you want to provide such a patch, or shall
> I do it?
> 
> 
>  Makefile                                      |   15 +++++++++++----
>  board/netstar/Makefile                        |    9 ++++++---
>  board/voiceblue/Makefile                      |   11 +++++++----
>  config.mk                                     |   12 +++++++++++-
>  nand_spl/board/amcc/acadia/Makefile           |    7 +++++--
>  nand_spl/board/amcc/bamboo/Makefile           |    7 +++++--
>  nand_spl/board/amcc/canyonlands/Makefile      |    7 +++++--
>  nand_spl/board/amcc/kilauea/Makefile          |    7 +++++--
>  nand_spl/board/amcc/sequoia/Makefile          |    7 +++++--
>  nand_spl/board/freescale/mpc8313erdb/Makefile |    7 +++++--
>  nand_spl/board/freescale/mx31pdk/Makefile     |    7 +++++--
>  nand_spl/board/samsung/smdk6400/Makefile      |    7 +++++--
>  nand_spl/board/sheldon/simpc8313/Makefile     |    7 +++++--
>  onenand_ipl/board/apollon/Makefile            |    7 +++++--
>  15 files changed, 86 insertions(+), 33 deletions(-)

Applied.

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
"Do we define evil as the absence of goodness? It seems only  logical
that shit happens--we discover this by the process of elimination."
                                                        -- Larry Wall


More information about the U-Boot mailing list