[U-Boot] [PATCH] common: Link with GCC instead of LD

Marek Vasut marex at denx.de
Wed Oct 31 17:32:48 CET 2012


Flip over from linking with LD to linking with GCC. This has some
long-term benefits, like easy path to enabling LTO.

Most of this patch is about passing parameters to the linker invoked
by GCC at the linking stage. This involves prefixing most of these with
-Wl,<param> . A few more adjustments had to be made though.

The LDFLAGS had to be extended by --build-id=none to prevent generation
of the .note.gnu.build-id section, which contains unique build-id we
don't care about. Moreover -nostdlib had to be added to LDFLAGS to link
properly without pulling in GCC libs during partial link.

The LDFLAGS_FINAL had to be augmented by -Wl,-allow-multiple-definition
to prevent GCC from complaining about multiple definitions of the register
containing global data.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Albert Aribaud <albert.u.boot at aribaud.net>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Mike Frysinger <vapier at gentoo.org>
Cc: Tom Rini <trini at ti.com>
Cc: Wolfgang Denk <wd at denx.de>
---
 Makefile                                       |    4 ++--
 arch/avr32/config.mk                           |    2 +-
 arch/blackfin/config.mk                        |    4 ++--
 arch/m68k/config.mk                            |    4 ++--
 arch/m68k/cpu/mcf5445x/config.mk               |    2 +-
 arch/m68k/cpu/mcf547x_8x/config.mk             |    2 +-
 arch/mips/config.mk                            |    4 ++--
 arch/mips/cpu/mips64/config.mk                 |    4 ++--
 arch/nds32/config.mk                           |    2 +-
 arch/nios2/config.mk                           |    2 +-
 arch/powerpc/config.mk                         |    2 +-
 arch/sh/config.mk                              |    4 ++--
 arch/x86/config.mk                             |    8 ++++----
 board/ait/cam_enc_4xx/config.mk                |    2 +-
 config.mk                                      |   15 +++++++--------
 examples/standalone/Makefile                   |    4 ++--
 nand_spl/board/amcc/acadia/Makefile            |    2 +-
 nand_spl/board/amcc/bamboo/Makefile            |    2 +-
 nand_spl/board/amcc/canyonlands/Makefile       |    2 +-
 nand_spl/board/amcc/kilauea/Makefile           |    2 +-
 nand_spl/board/amcc/sequoia/Makefile           |    2 +-
 nand_spl/board/freescale/mpc8313erdb/Makefile  |    2 +-
 nand_spl/board/freescale/mpc8315erdb/Makefile  |    2 +-
 nand_spl/board/freescale/mpc8536ds/Makefile    |    2 +-
 nand_spl/board/freescale/mpc8569mds/Makefile   |    2 +-
 nand_spl/board/freescale/mpc8572ds/Makefile    |    2 +-
 nand_spl/board/freescale/mx31pdk/Makefile      |    2 +-
 nand_spl/board/freescale/p1010rdb/Makefile     |    2 +-
 nand_spl/board/freescale/p1023rds/Makefile     |    2 +-
 nand_spl/board/freescale/p1_p2_rdb/Makefile    |    2 +-
 nand_spl/board/freescale/p1_p2_rdb_pc/Makefile |    2 +-
 nand_spl/board/karo/tx25/Makefile              |    2 +-
 nand_spl/board/samsung/smdk6400/Makefile       |    2 +-
 nand_spl/board/sheldon/simpc8313/Makefile      |    2 +-
 spl/Makefile                                   |    4 ++--
 35 files changed, 52 insertions(+), 53 deletions(-)

NOTE: It should mostly work, but _PLEASE_ test it properly. I definitelly
      can not run it on most of the affected platforms. Besides, it might
      still hit some build issues, it's not properly compiler-tested. Any
      additional fixes are welcome ;-)

NOTE: I detected code size being smaller by a few bytes, but then it might
      cause breakage, so I'd be really cautious here.

diff --git a/Makefile b/Makefile
index 2fe1490..d6b3433 100644
--- a/Makefile
+++ b/Makefile
@@ -539,8 +539,8 @@ GEN_UBOOT = \
 		sed  -n -e 's/.*\($(SYM_PREFIX)_u_boot_list_.*\)/-u\1/p'|sort|uniq`;\
 		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
 			$$UNDEF_LST $(__OBJS) \
-			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-			-Map u-boot.map -o u-boot
+			-Wl,--start-group $(__LIBS) -Wl,--end-group \
+			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
 endif
 
 $(obj)u-boot:	depend \
diff --git a/arch/avr32/config.mk b/arch/avr32/config.mk
index a751a3d..151f232 100644
--- a/arch/avr32/config.mk
+++ b/arch/avr32/config.mk
@@ -28,4 +28,4 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
 PLATFORM_RELFLAGS	+= -ffunction-sections -fdata-sections
 
-LDFLAGS_u-boot		= --gc-sections --relax
+LDFLAGS_u-boot		= -Wl,--gc-sections -Wl,--relax
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 3595aa2..cbfba5f 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -37,8 +37,8 @@ CONFIG_BFIN_BOOT_MODE := $(strip $(subst ",,$(CONFIG_BFIN_BOOT_MODE)))
 PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic
 PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
 
-LDFLAGS_FINAL += --gc-sections
-LDFLAGS += -m elf32bfin
+LDFLAGS_FINAL += -Wl,--gc-sections
+LDFLAGS += -Wl,-m elf32bfin
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 
 PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU)
diff --git a/arch/m68k/config.mk b/arch/m68k/config.mk
index 11ba334..2e5adb9 100644
--- a/arch/m68k/config.mk
+++ b/arch/m68k/config.mk
@@ -26,6 +26,6 @@ CROSS_COMPILE ?= m68k-elf-
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x20000
 
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
-PLATFORM_LDFLAGS  += -n
+PLATFORM_LDFLAGS  += -Wl,-n
 PLATFORM_RELFLAGS              += -ffunction-sections -fdata-sections
-LDFLAGS_FINAL                  += --gc-sections
+LDFLAGS_FINAL                  += -Wl,--gc-sections
diff --git a/arch/m68k/cpu/mcf5445x/config.mk b/arch/m68k/cpu/mcf5445x/config.mk
index 0c48783..bd216a9 100644
--- a/arch/m68k/cpu/mcf5445x/config.mk
+++ b/arch/m68k/cpu/mcf5445x/config.mk
@@ -38,6 +38,6 @@ endif
 
 ifneq (,$(findstring -linux-,$(shell $(CC) --version)))
 ifneq (,$(findstring GOT,$(shell $(LD) --help)))
-PLATFORM_LDFLAGS += --got=single
+PLATFORM_LDFLAGS += -Wl,--got=single
 endif
 endif
diff --git a/arch/m68k/cpu/mcf547x_8x/config.mk b/arch/m68k/cpu/mcf547x_8x/config.mk
index 02fce5d..00907d3 100644
--- a/arch/m68k/cpu/mcf547x_8x/config.mk
+++ b/arch/m68k/cpu/mcf547x_8x/config.mk
@@ -28,6 +28,6 @@ PLATFORM_CPPFLAGS += -mcpu=5485 -fPIC
 
 ifneq (,$(findstring -linux-,$(shell $(CC) --version)))
 ifneq (,$(findstring GOT,$(shell $(LD) --help)))
-PLATFORM_LDFLAGS += --got=single
+PLATFORM_LDFLAGS += -Wl,--got=single
 endif
 endif
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index de9140b..c21d313 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -63,6 +63,6 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 #
 PLATFORM_CPPFLAGS		+= -G 0 -mabicalls -fpic $(ENDIANNESS)
 PLATFORM_CPPFLAGS		+= -msoft-float
-PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib $(ENDIANNESS)
+PLATFORM_LDFLAGS		+= -G 0 -static -Wl,-n $(ENDIANNESS)
 PLATFORM_RELFLAGS		+= -ffunction-sections -fdata-sections
-LDFLAGS_FINAL			+= --gc-sections
+LDFLAGS_FINAL			+= -Wl,--gc-sections
diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
index ebc1ceb..d9fbf27 100644
--- a/arch/mips/cpu/mips64/config.mk
+++ b/arch/mips/cpu/mips64/config.mk
@@ -32,9 +32,9 @@ MIPSFLAGS = -march=mips64
 PLATFORM_CPPFLAGS += $(MIPSFLAGS)
 PLATFORM_CPPFLAGS += -mabi=64 -DCONFIG_64BIT
 ifdef CONFIG_SYS_BIG_ENDIAN
-PLATFORM_LDFLAGS  += -m elf64btsmip
+PLATFORM_LDFLAGS  += -Wl,-m elf64btsmip
 else
-PLATFORM_LDFLAGS  += -m elf64ltsmip
+PLATFORM_LDFLAGS  += -Wl,-m elf64ltsmip
 endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 -T mips64.lds
diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index c589829..eccd2e6 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -32,4 +32,4 @@ PLATFORM_RELFLAGS	+= -fno-strict-aliasing -fno-common -mrelax
 PLATFORM_RELFLAGS	+= -gdwarf-2
 PLATFORM_CPPFLAGS	+= -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie
 
-LDFLAGS_u-boot		= --gc-sections --relax
+LDFLAGS_u-boot		= -Wl,--gc-sections -Wl,--relax
diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk
index 7b03ed8..9f9f6ac 100644
--- a/arch/nios2/config.mk
+++ b/arch/nios2/config.mk
@@ -29,5 +29,5 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x02000000
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -G0
 
-LDFLAGS_FINAL += --gc-sections
+LDFLAGS_FINAL += -Wl,--gc-sections
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index a307154..87e4934 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -24,7 +24,7 @@
 CROSS_COMPILE ?= ppc_8xx-
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
-LDFLAGS_FINAL += --gc-sections
+LDFLAGS_FINAL += -Wl,--gc-sections
 PLATFORM_RELFLAGS += -fpic -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 07ff8b9..3451223 100644
--- a/arch/sh/config.mk
+++ b/arch/sh/config.mk
@@ -29,5 +29,5 @@ CONFIG_STANDALONE_LOAD_ADDR += -EB
 endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
-PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym reloc_dst=$(CONFIG_SYS_TEXT_BASE)
-LDFLAGS_FINAL = --gc-sections
+PLATFORM_LDFLAGS += -Wl,-e $(CONFIG_SYS_TEXT_BASE) -Wl,--defsym reloc_dst=$(CONFIG_SYS_TEXT_BASE)
+LDFLAGS_FINAL = -Wl,--gc-sections
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 23cacff..b3b07cc 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -38,11 +38,11 @@ PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0
 
 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 
-PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions
+PLATFORM_LDFLAGS += -Wl,--emit-relocs -Wl,-Bsymbolic -Wl,-Bsymbolic-functions
 
-LDFLAGS_FINAL += --gc-sections -pie
-LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
-LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
+LDFLAGS_FINAL += -Wl,--gc-sections -pie
+LDFLAGS_FINAL += -Wl,--wrap=__divdi3 -Wl,--wrap=__udivdi3
+LDFLAGS_FINAL += -Wl,--wrap=__moddi3 -Wl,--wrap=__umoddi3
 
 NORMAL_LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
 PREFIXED_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/$(shell basename $(NORMAL_LIBGCC))
diff --git a/board/ait/cam_enc_4xx/config.mk b/board/ait/cam_enc_4xx/config.mk
index 744b927..0792c84 100644
--- a/board/ait/cam_enc_4xx/config.mk
+++ b/board/ait/cam_enc_4xx/config.mk
@@ -18,5 +18,5 @@ else
 # the following error message:
 # arm-linux-ld: u-boot-spl: Not enough room for program headers, try linking
 # with -N
-LDFLAGS_u-boot-spl += -n
+LDFLAGS_u-boot-spl += -Wl,-n
 endif
diff --git a/config.mk b/config.mk
index b7cd481..ec8cd6b 100644
--- a/config.mk
+++ b/config.mk
@@ -137,9 +137,8 @@ binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
 #
 AS	= $(CROSS_COMPILE)as
 
-# Always use GNU ld
-LD	= $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \
-		then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;)
+# Link with GCC
+LD	= $(CROSS_COMPILE)gcc
 
 CC	= $(CROSS_COMPILE)gcc
 CPP	= $(CC) -E
@@ -202,7 +201,7 @@ CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
 CPPFLAGS += -ffunction-sections -fdata-sections
-LDFLAGS_FINAL += --gc-sections
+LDFLAGS_FINAL += -Wl,--gc-sections -Wl,--build-id=none
 endif
 
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
@@ -265,17 +264,17 @@ endif
 
 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
 
-LDFLAGS += $(PLATFORM_LDFLAGS)
-LDFLAGS_FINAL += -Bstatic
+LDFLAGS += $(PLATFORM_LDFLAGS) -Wl,--build-id=none -nostdlib
+LDFLAGS_FINAL += -Wl,-Bstatic -Wl,-allow-multiple-definition
 
 LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
-LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
+LDFLAGS_u-boot += -Wl,-Ttext -Wl,$(CONFIG_SYS_TEXT_BASE)
 endif
 
 LDFLAGS_u-boot-spl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
 ifneq ($(CONFIG_SPL_TEXT_BASE),)
-LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE)
+LDFLAGS_u-boot-spl += -Wl,-Ttext -Wl,$(CONFIG_SPL_TEXT_BASE)
 endif
 
 # Linus' kernel sanity checking tool
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index baaa2fb..eaf8bb3 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -96,8 +96,8 @@ $(LIB):	$(obj).depend $(LIBOBJS)
 
 $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
-		$(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
-			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
+		$(LD) $(LDFLAGS) -g -Wl,-Ttext -Wl,$(CONFIG_STANDALONE_LOAD_ADDR) \
+			-o $@ -Wl,-e -Wl,$(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
 $(SREC):
diff --git a/nand_spl/board/amcc/acadia/Makefile b/nand_spl/board/amcc/acadia/Makefile
index 84cb8ab..6a75e34 100644
--- a/nand_spl/board/amcc/acadia/Makefile
+++ b/nand_spl/board/amcc/acadia/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/amcc/bamboo/Makefile b/nand_spl/board/amcc/bamboo/Makefile
index 6430219..5fa1a3b 100644
--- a/nand_spl/board/amcc/bamboo/Makefile
+++ b/nand_spl/board/amcc/bamboo/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/amcc/canyonlands/Makefile b/nand_spl/board/amcc/canyonlands/Makefile
index 509a46e..4e2eae4 100644
--- a/nand_spl/board/amcc/canyonlands/Makefile
+++ b/nand_spl/board/amcc/canyonlands/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/amcc/kilauea/Makefile b/nand_spl/board/amcc/kilauea/Makefile
index 104b7e2..55900ed 100644
--- a/nand_spl/board/amcc/kilauea/Makefile
+++ b/nand_spl/board/amcc/kilauea/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/amcc/sequoia/Makefile b/nand_spl/board/amcc/sequoia/Makefile
index 54e8a12..dc41c1f 100644
--- a/nand_spl/board/amcc/sequoia/Makefile
+++ b/nand_spl/board/amcc/sequoia/Makefile
@@ -27,7 +27,7 @@ include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/mpc8313erdb/Makefile b/nand_spl/board/freescale/mpc8313erdb/Makefile
index cff2a43..9fe4472 100644
--- a/nand_spl/board/freescale/mpc8313erdb/Makefile
+++ b/nand_spl/board/freescale/mpc8313erdb/Makefile
@@ -30,7 +30,7 @@ include $(TOPDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 	   $(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/mpc8315erdb/Makefile b/nand_spl/board/freescale/mpc8315erdb/Makefile
index cff2a43..9fe4472 100644
--- a/nand_spl/board/freescale/mpc8315erdb/Makefile
+++ b/nand_spl/board/freescale/mpc8315erdb/Makefile
@@ -30,7 +30,7 @@ include $(TOPDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 	   $(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/mpc8536ds/Makefile b/nand_spl/board/freescale/mpc8536ds/Makefile
index e5388d8..6d91269 100644
--- a/nand_spl/board/freescale/mpc8536ds/Makefile
+++ b/nand_spl/board/freescale/mpc8536ds/Makefile
@@ -33,7 +33,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 		$(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/mpc8569mds/Makefile b/nand_spl/board/freescale/mpc8569mds/Makefile
index e5388d8..6d91269 100644
--- a/nand_spl/board/freescale/mpc8569mds/Makefile
+++ b/nand_spl/board/freescale/mpc8569mds/Makefile
@@ -33,7 +33,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 		$(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/mpc8572ds/Makefile b/nand_spl/board/freescale/mpc8572ds/Makefile
index e5388d8..6d91269 100644
--- a/nand_spl/board/freescale/mpc8572ds/Makefile
+++ b/nand_spl/board/freescale/mpc8572ds/Makefile
@@ -33,7 +33,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 		$(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/mx31pdk/Makefile b/nand_spl/board/freescale/mx31pdk/Makefile
index 43e72c4..1213cf2 100644
--- a/nand_spl/board/freescale/mx31pdk/Makefile
+++ b/nand_spl/board/freescale/mx31pdk/Makefile
@@ -7,7 +7,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/p1010rdb/Makefile b/nand_spl/board/freescale/p1010rdb/Makefile
index f270faa..8dfaf0c 100644
--- a/nand_spl/board/freescale/p1010rdb/Makefile
+++ b/nand_spl/board/freescale/p1010rdb/Makefile
@@ -33,7 +33,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/p1023rds/Makefile b/nand_spl/board/freescale/p1023rds/Makefile
index b288284..39b2588 100644
--- a/nand_spl/board/freescale/p1023rds/Makefile
+++ b/nand_spl/board/freescale/p1023rds/Makefile
@@ -28,7 +28,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 		$(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/p1_p2_rdb/Makefile b/nand_spl/board/freescale/p1_p2_rdb/Makefile
index e5388d8..6d91269 100644
--- a/nand_spl/board/freescale/p1_p2_rdb/Makefile
+++ b/nand_spl/board/freescale/p1_p2_rdb/Makefile
@@ -33,7 +33,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 		$(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/freescale/p1_p2_rdb_pc/Makefile b/nand_spl/board/freescale/p1_p2_rdb_pc/Makefile
index 7146d16..b3514ac 100644
--- a/nand_spl/board/freescale/p1_p2_rdb_pc/Makefile
+++ b/nand_spl/board/freescale/p1_p2_rdb_pc/Makefile
@@ -33,7 +33,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 		$(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/karo/tx25/Makefile b/nand_spl/board/karo/tx25/Makefile
index becf7fa..628bfee 100644
--- a/nand_spl/board/karo/tx25/Makefile
+++ b/nand_spl/board/karo/tx25/Makefile
@@ -28,7 +28,7 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
 LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 	   $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
diff --git a/nand_spl/board/samsung/smdk6400/Makefile b/nand_spl/board/samsung/smdk6400/Makefile
index c9e75ba..75b7b0f 100644
--- a/nand_spl/board/samsung/smdk6400/Makefile
+++ b/nand_spl/board/samsung/smdk6400/Makefile
@@ -32,7 +32,7 @@ include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 		$(LDFLAGS_FINAL) -gc-sections
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL -ffunction-sections
diff --git a/nand_spl/board/sheldon/simpc8313/Makefile b/nand_spl/board/sheldon/simpc8313/Makefile
index 2a3ddac..a73fa87 100644
--- a/nand_spl/board/sheldon/simpc8313/Makefile
+++ b/nand_spl/board/sheldon/simpc8313/Makefile
@@ -30,7 +30,7 @@ include $(TOPDIR)/config.mk
 nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
+LDFLAGS := -T $(nandobj)u-boot.lds -Wl,-Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
 	   $(LDFLAGS) $(LDFLAGS_FINAL)
 AFLAGS	+= -DCONFIG_NAND_SPL
 CFLAGS	+= -DCONFIG_NAND_SPL
diff --git a/spl/Makefile b/spl/Makefile
index 3195390..6d9b4ae 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -139,8 +139,8 @@ $(obj)u-boot-spl.bin:	$(obj)u-boot-spl
 
 GEN_UBOOT = \
 	cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \
-		--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-		-Map u-boot-spl.map -o u-boot-spl
+		-Wl,--start-group -Wl,$(__LIBS) -Wl,--end-group -Wl,$(PLATFORM_LIBS) \
+		-Wl,-Map=u-boot-spl.map -o u-boot-spl
 
 $(obj)u-boot-spl:	depend $(START) $(LIBS) $(obj)u-boot-spl.lds
 	$(GEN_UBOOT)
-- 
1.7.10.4



More information about the U-Boot mailing list