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

Haiying Wang Haiying.Wang at freescale.com
Mon Jan 31 21:14:10 CET 2011


On Mon, 2011-01-31 at 20:33 +0100, Wolfgang Denk wrote:

> If I understand the intention of the LDFLAGS_u-boot setting
> corrrectly, then you would have to add a "LDFLAGS_nand_spl" setting.
No, I don't want to add a LDFLAGS_nand_spl for nand_spl only, I need LDFLAGS_FINAL to be passed to nand spl, tpl, and final uboot images.

> If you introduce a new LDFLAGS_FINAL instead, then why do we have to
> keep LDFLAGS_u-boot - isn't LDFLAGS_u-boot also for "final" linking of
> the U-Boot image?
LDFLAGS_FINAL does not provide the whole set of linker options to U-Boot
image, so it does not replace the LDFLAGS_u-boot, in patch:

-LDFLAGS_u-boot += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
+LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)

> [Btw: "final" is probably not a technically correct term for all the
> use cases I see below.]
did not think of any better term.

> ...
> > diff --git a/config.mk b/config.mk
> > index 5147c35..caa6221 100644
> > --- a/config.mk
> > +++ b/config.mk
> > @@ -205,8 +205,9 @@ endif
> >  AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
> >  
> >  LDFLAGS += $(PLATFORM_LDFLAGS)
> > +LDFLAGS_FINAL += -Bstatic $(LDFLAGS)
> >  
> > -LDFLAGS_u-boot += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
> > +LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
> 
> Is it intentional that you change PLATFORM_LDFLAGS into LDFLAGS here?
Yes. it LDFLAGS_FINAL here includes "-Bstatic $(PLATFORM_LDFLAGS)".

> Are you sure that this change is correct for all affected boards?
Can not 100% sure because I can not test all the affected boards.

> How has this change been tested?
I only can test powerpc by MAKEALL. 
> 
> > -LDFLAGS	= -Bstatic -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)
> > +LDFLAGS_spl := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS_FINAL)
> 
> 
> Arghhh...  Here you introduce yet another setting, LDFLAGS_spl ?
This is an intentional name change. LDFLAGS_spl is used here as LDFLAGS_u-boot, but for nand spl linkage. Actually it is not a new FLAGS, just add *_spl* here so that it can be differed from the LDFlAGS in toplevel config.mk.

> This is not mentioned in the commit message.  And why do we need it?
> Isn't LDFLAGS_FINAL enough?
As said, it is not a new flag, just a name change.

> 
> Will I soon see patches to also add LDFLAGS_tpl?
Yes, in patch 3/6.

> 
> This is becoming a mess.  We need to find a simple, clean way to solve
> this.  I'm on the verge of reverting the LDFLAGS_u-boot commit.

We just want to make sure gc-sections works for all the uboot images. :)

Haiying





More information about the U-Boot mailing list