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

login
register
mail settings
Submitter Haiying Wang
Date Feb. 1, 2011, 2:59 p.m.
Message ID <1296572397.1995.15.camel@haiying-laptop>
Download mbox | patch
Permalink /patch/81322/
State Superseded
Headers show

Comments

Haiying Wang - Feb. 1, 2011, 2:59 p.m.
On Tue, 2011-02-01 at 08:34 +0100, Wolfgang Denk wrote:

> Can you please be more specific?  I don't see where "the
> LDFLAGS_u-boot commit" (you mean 8aba9dc ?) would change any related
> code.  The relevant hunk looks like this:
> 
> @@ -204,9 +204,11 @@ endif
>  
>  AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
>  
> -LDFLAGS += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
> +LDFLAGS += $(PLATFORM_LDFLAGS)
> +
> +LDFLAGS_u-boot += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
>  ifneq ($(CONFIG_SYS_TEXT_BASE),)
> -LDFLAGS += -Ttext $(CONFIG_SYS_TEXT_BASE)
> +LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
>  endif
>  
>  # Location of a usable BFD library, where we define "usable" as
> 
> and this does not make any changes of PLATFORM_LDFLAGS into LDFLAGS
> or vice versa.
> 
But PLATFORM_LDFLAGS has been changed in $(CPUDIR)/config.mk.

You can see in commit 8aba9dc:


+LDFLAGS += $(PLATFORM_LDFLAGS)

And later in this config.mk, 

@@ -259,7 +261,7 @@ $(obj)%.s:  %.c
 
 # If the list of objects to link is empty, just create an empty built-in.o
 cmd_link_o_target = $(if $(strip $1),\
-                     $(LD) -r -o $@ $1 ,\
+                     $(LD) $(LDFLAGS) -r -o $@ $1,\
                      rm -f $@; $(AR) rcs $@ )


LDFLAGS is added in cmd_link_o_target which made changes to build
nand_spl.

Haiying

Patch

--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -24,10 +24,10 @@ 
 CROSS_COMPILE ?= ppc_8xx-
 
 STANDALONE_LOAD_ADDR = 0x40000
-
+LDFLAGS_u-boot = --gc-sections
 PLATFORM_RELFLAGS += -mrelocatable -ffunction-sections -fdata-sections
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
-PLATFORM_LDFLAGS  += -n --gc-sections
+PLATFORM_LDFLAGS  += -n

Here, --gc-sections is set only for LDFLAGS_u-boot, the PLATFORM_LDFLAGS
does have --gc-sections, So in toplevel config.mk: