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

Haiying Wang Haiying.Wang at freescale.com
Fri Jan 28 19:46:06 CET 2011


On Fri, 2011-01-28 at 12:30 -0600, Scott Wood wrote:
> > > > diff --git a/config.mk b/config.mk
> > > > index 5147c35..d7bb07f 100644
> > > > --- a/config.mk
> > > > +++ b/config.mk
> > > > @@ -260,8 +260,13 @@ $(obj)%.s:	%.c
> > > >  #########################################################################
> > > >  
> > > >  # If the list of objects to link is empty, just create an empty built-in.o
> > > > +ifdef CONFIG_HAS_TPL
> > > > +cmd_link_o_target = $(if $(strip $1),\
> > > > +		      $(LD) -r -o $@ $1,\
> > > > +		      rm -f $@; $(AR) rcs $@ )
> > > > +else
> > > >  cmd_link_o_target = $(if $(strip $1),\
> > > >  		      $(LD) $(LDFLAGS) -r -o $@ $1,\
> > > >  		      rm -f $@; $(AR) rcs $@ )
> > > > -
> > > > +endif
> > > 
> > > What's going on here?
> > > 
> > For CONFIG_HAS_TPL, LDFLAGS has --gc-sections now, passing it to
> > cmd_link_o_target here will fail in linking stage:
> > "
> > powerpc-none-linux-gnuspe-ld: gc-sections requires either an entry or an
> > undefined symbol
> > "
> 
> I think --gc-sections should go in LDFLAGS_u-boot instead.
LDFLAGS_u-boot has --gc-sections already, I did not change it. I only add --gc-sections to PLATFORM_LDFLAGS in arch/powerpc/config.mk under "ifdef CONFIG_HAS_TPL"

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

Thanks.

Haiying





More information about the U-Boot mailing list