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

Wolfgang Denk wd at denx.de
Mon Jan 31 20:33:09 CET 2011


Dear Haiying.Wang at freescale.com,

In message <1296498767-26408-1-git-send-email-Haiying.Wang at freescale.com> you wrote:
> From: Haiying Wang <Haiying.Wang at freescale.com>
> 
> commit 8aba9dceebb14144e07d19593111ee3a999c37fc
> Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS
> 
> breaks the usage of --gc-section to build nand_spl. We still need linker option
> --gc-section for every uboot image, not only the main one. LDFLAGS_FINAL passes
> the --gc-sections to each uboot image.

If I understand the intention of the LDFLAGS_u-boot setting
corrrectly, then you would have to add a "LDFLAGS_nand_spl" setting.

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?

[Btw: "final" is probably not a technically correct term for all the
use cases I see below.]

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

Are you sure that this change is correct for all affected boards?

How has this change been tested?


> -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 not mentioned in the commit message.  And why do we need it?
Isn't LDFLAGS_FINAL enough?


Will I soon see patches to also add LDFLAGS_tpl?


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.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Contrary to popular belief, thinking does not cause brain damage.


More information about the U-Boot mailing list