From mboxrd@z Thu Jan 1 00:00:00 1970 From: Haiying Wang Date: Fri, 28 Jan 2011 13:46:06 -0500 Subject: [U-Boot] [PATCH 7/7] add gc-sections to TPL boot In-Reply-To: <20110128123001.039ce7f6@udp111988uds.am.freescale.net> References: <1296190690-21146-1-git-send-email-Haiying.Wang@freescale.com> <1296190690-21146-5-git-send-email-Haiying.Wang@freescale.com> <20110128113646.4567b1fb@udp111988uds.am.freescale.net> <1296238110.2918.87.camel@haiying-laptop> <20110128123001.039ce7f6@udp111988uds.am.freescale.net> Message-ID: <1296240366.2918.104.camel@haiying-laptop> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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