[U-Boot] [PATCH 7/7] add gc-sections to TPL boot

Scott Wood scottwood at freescale.com
Fri Jan 28 19:58:39 CET 2011


On Fri, 28 Jan 2011 13:46:06 -0500
Haiying Wang <Haiying.Wang at freescale.com> wrote:

> On Fri, 2011-01-28 at 12:30 -0600, Scott Wood wrote:
> > I think --gc-sections should go in LDFLAGS_u-boot instead.
> LDFLAGS_u-boot has --gc-sections already, I did not change it.

It looks like LDFLAGS_u-boot may not be suitable for building SPL/TPL
images.  Since TPL is new, and we don't have to worry about breaking
any existing boards, just unconditionally use --gc-sections when
linking the final TPL image.  Or, if we want a way for
boards/cpus to add ld options that things like TPL use, introduce
LDFLAGS_FINAL that holds ld parameters used for final link of any
image, with LDFLAGS_u-boot holding things like text addresses and linker
scripts with values that only apply to the main image.

I'd prefer the latter approach, as we could make use of it in SPL as
well, which does have existing boards to worry about.

> > In any case, I don't think we want different behavior here based on
> > whether we have TPL.  Either LDFLAGS is used in partial linking, or
> > it's not.
> I don't understand why LDFLAGS was added here in patch
> http://lists.denx.de/pipermail/u-boot/2011-January/084705.html
> 
> It says "LDFLAGS sets necessary option by partial linking (use in
> cmd_link_o_target)." But without this changing, the partial linking
> worked well before. Please correct me if I am wrong.
> 
> So if someone can confirm LDFLAGS is not necessary to be added in
> cmd_link_o_target, I prefer not add it here.

Whether leaving out -n during partial link worked for you or not,
LDFLAGS is supposed to be used by partial links (that distinction is
why LDFLAGS_u-boot was created).  So don't put things in LDFPLAGS that
break partial links.

-Scott



More information about the U-Boot mailing list