[U-Boot] [PATCH] Introduce a new linker flag LDFLAGS_FINAL

Haiying Wang Haiying.Wang at freescale.com
Fri Feb 4 16:52:38 CET 2011


Dear Wolfgang,

On Tue, 2011-02-01 at 14:40 -0600, Scott Wood wrote: 
> On Tue, 1 Feb 2011 21:20:50 +0100
> Wolfgang Denk <wd at denx.de> wrote:
> 
> > Dear Scott Wood,
> > 
> > In message <20110201135136.0817fe5a at udp111988uds.am.freescale.net> you wrote:
> > >
> > > > > Prior to the introduction of LDFLAGS_u-boot, was LDFLAGS not what was
> > > > > used?  So before, anything that board/cpu code adds directly to LDFLAGS
> > > > > (maybe they're supposed to use PLATFORM_LDFLAGS, but not all do) was
> > > > > used in the final link.  After 8aba9dc, only things in
> > > > > PLATFORM_LDFLAGS plus -Bstatic and -T are used in the final link.
> > > > 
> > > > And this is correct for all boards?
> > > 
> > > By "this" do you mean the switch to PLATFORM_LDFLAGS in 8aba9dc, or the
> > > switch back to LDFLAGS?  It's not obvious to me that the dropping of
> > 
> > I don;t understand why you contine to talk about "switch to
> > PLATFORM_LDFLAGS in 8aba9dc".  There was no such switch - at least I
> > cannot see it.
> > 
> > I see only a switch in your patch.  This is why I'm asking.
> 
> Before 8aba9dc, the flags for the final link were produced by taking
> the existing LDFLAGS, and adding:
> -Bstatic -T <linkerscript> $(PLATFORM_LDFLAGS) -Ttext <addr>.
> 
> This included anything that cpu/board code added to LDFLAGS -- some
> architectures added --gc-sections, x86 added --cref, etc.  Since the above
> flags are added to LDFLAGS, rather than replacing them, these flags got used
> in the final link.
> 
> Commit 8aba9dc introduces LDFLAGS_u-boot, so that LDFLAGS is no longer the
> source for the flags for the final link.  It generates LDFLAGS_u-boot using
> PLATFORM_LDFLAGS, not LDFLAGS.  It converts most of the board/cpu updates to
> LDFLAGS into LDFLAGS_u-boot, but it missed --cref.
> 
> I don't see any other LDFLAGS changes in board/cpu code, so the distinction
> between using LDFLAGS and PLATFORM_LDFLAGS should have no other impact on
> current boards.  However, the patch appears to be intended to support
> platform linker flags that need to be used during partial link, which
> would involve board/cpu additions to LDFLAGS.  This change would break that
> only if those options need to be used for partial link *only*, and cannot be
> used in the final link.  In such a case I'd suggest using something like
> LDFLAGS_PARTIAL to make this explicit.  But I'd be surprised if that
> were actually the case.
> 
> If you're looking to cut down on the number of variables, it's not clear to
> me what PLATFORM_LDFLAGS is supposed to mean distinct from adding to
> LDFLAGS.
> 
> -Scott

Do you have time to read Scott's email and give us any further
recommendation? We do need to solve the issues of partial linking caused
by commit 8aba9dc.

Thanks.

Haiying






More information about the U-Boot mailing list