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

2011-03-22 Thread Wolfgang Denk
Dear haiying.w...@freescale.com,

In message <1298410685-21335-1-git-send-email-haiying.w...@freescale.com> you 
wrote:
> From: Haiying Wang 
> 
> 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.
> 
> To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace 
> PLATFORM_LDFLAGS in the Makefile of each nand_spl board.
> 
> Signed-off-by: Scott Wood 
> Signed-off-by: Haiying Wang 
> ---
> v3: remove LDFLAGS from LDFLAGS_FINAL since it is already in LDFLAGS_u-boot, 
> and
> add LDFLAGS to each nand_spl board's LDFLAGS
>  arch/blackfin/config.mk   |2 +-
>  arch/i386/config.mk   |2 +-
>  arch/nios2/config.mk  |2 +-
>  arch/powerpc/config.mk|2 +-
>  arch/sh/config.mk |2 +-
>  config.mk |3 ++-
>  nand_spl/board/amcc/acadia/Makefile   |3 ++-
>  nand_spl/board/amcc/bamboo/Makefile   |3 ++-
>  nand_spl/board/amcc/canyonlands/Makefile  |3 ++-
>  nand_spl/board/amcc/kilauea/Makefile  |3 ++-
>  nand_spl/board/amcc/sequoia/Makefile  |3 ++-
>  nand_spl/board/davinci/da8xxevm/Makefile  |3 ++-
>  nand_spl/board/freescale/mpc8313erdb/Makefile |4 ++--
>  nand_spl/board/freescale/mpc8315erdb/Makefile |4 ++--
>  nand_spl/board/freescale/mpc8536ds/Makefile   |3 ++-
>  nand_spl/board/freescale/mpc8569mds/Makefile  |3 ++-
>  nand_spl/board/freescale/mpc8572ds/Makefile   |3 ++-
>  nand_spl/board/freescale/mx31pdk/Makefile |3 ++-
>  nand_spl/board/freescale/p1_p2_rdb/Makefile   |3 ++-
>  nand_spl/board/karo/tx25/Makefile |3 ++-
>  nand_spl/board/samsung/smdk6400/Makefile  |3 ++-
>  nand_spl/board/sheldon/simpc8313/Makefile |4 ++--
>  22 files changed, 39 insertions(+), 25 deletions(-)

Applied, thanks.

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: w...@denx.de
A dog always bit deepest on the veterinary hand.
- Terry Pratchett, _Wyrd Sisters_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2011-02-22 Thread Haiying.Wang
From: Haiying Wang 

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.

To get the proper linker flags, we use LDFLAGS and LDFLAGS_FINAL to replace 
PLATFORM_LDFLAGS in the Makefile of each nand_spl board.

Signed-off-by: Scott Wood 
Signed-off-by: Haiying Wang 
---
v3: remove LDFLAGS from LDFLAGS_FINAL since it is already in LDFLAGS_u-boot, and
add LDFLAGS to each nand_spl board's LDFLAGS
 arch/blackfin/config.mk   |2 +-
 arch/i386/config.mk   |2 +-
 arch/nios2/config.mk  |2 +-
 arch/powerpc/config.mk|2 +-
 arch/sh/config.mk |2 +-
 config.mk |3 ++-
 nand_spl/board/amcc/acadia/Makefile   |3 ++-
 nand_spl/board/amcc/bamboo/Makefile   |3 ++-
 nand_spl/board/amcc/canyonlands/Makefile  |3 ++-
 nand_spl/board/amcc/kilauea/Makefile  |3 ++-
 nand_spl/board/amcc/sequoia/Makefile  |3 ++-
 nand_spl/board/davinci/da8xxevm/Makefile  |3 ++-
 nand_spl/board/freescale/mpc8313erdb/Makefile |4 ++--
 nand_spl/board/freescale/mpc8315erdb/Makefile |4 ++--
 nand_spl/board/freescale/mpc8536ds/Makefile   |3 ++-
 nand_spl/board/freescale/mpc8569mds/Makefile  |3 ++-
 nand_spl/board/freescale/mpc8572ds/Makefile   |3 ++-
 nand_spl/board/freescale/mx31pdk/Makefile |3 ++-
 nand_spl/board/freescale/p1_p2_rdb/Makefile   |3 ++-
 nand_spl/board/karo/tx25/Makefile |3 ++-
 nand_spl/board/samsung/smdk6400/Makefile  |3 ++-
 nand_spl/board/sheldon/simpc8313/Makefile |4 ++--
 22 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 0cba294..f4503ea 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -30,7 +30,7 @@ CONFIG_BFIN_BOOT_MODE := $(strip $(subst 
",,$(CONFIG_BFIN_BOOT_MODE)))
 PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic
 PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
 
-LDFLAGS_u-boot += --gc-sections
+LDFLAGS_FINAL += --gc-sections
 LDFLAGS += -m elf32bfin
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 
diff --git a/arch/i386/config.mk b/arch/i386/config.mk
index a84af63..67aac0d 100644
--- a/arch/i386/config.mk
+++ b/arch/i386/config.mk
@@ -38,6 +38,6 @@ PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 
 PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions
 
-LDFLAGS_u-boot += --gc-sections -pie
+LDFLAGS_FINAL += --gc-sections -pie
 LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
 
diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk
index fa93180..d241a96 100644
--- a/arch/nios2/config.mk
+++ b/arch/nios2/config.mk
@@ -31,5 +31,5 @@ PLATFORM_CPPFLAGS += -G0
 
 LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
 
-LDFLAGS_u-boot += --gc-sections
+LDFLAGS_FINAL += --gc-sections
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index 64191c7..31e4416 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -24,7 +24,7 @@
 CROSS_COMPILE ?= ppc_8xx-
 
 STANDALONE_LOAD_ADDR = 0x4
-LDFLAGS_u-boot = --gc-sections
+LDFLAGS_FINAL += --gc-sections
 PLATFORM_RELFLAGS += -mrelocatable -ffunction-sections -fdata-sections
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
diff --git a/arch/sh/config.mk b/arch/sh/config.mk
index 433cc15..48393b5 100644
--- a/arch/sh/config.mk
+++ b/arch/sh/config.mk
@@ -30,7 +30,7 @@ endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
 PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym 
reloc_dst=$(CONFIG_SYS_TEXT_BASE)
-LDFLAGS_u-boot = --gc-sections
+LDFLAGS_FINAL = --gc-sections
 
 ifdef CONFIG_SYS_LDSCRIPT
 LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
diff --git a/config.mk b/config.mk
index 5147c35..d80c02a 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_u-boot += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
+LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
 endif
diff --git a/nand_spl/board/amcc/acadia/Makefile 
b/nand_spl/board/amcc/acadia/Makefile
index f8ca654..f4323d5 100644
--- a/nand_spl/board/amcc/acadia/Makefile
+++ b/nand_spl/board/amcc/acadia/Makefile
@@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk
 include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS= -Bstatic -T $(nandobj)u-boot.lds -Ttext 
$(CON