]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS
authorNobuhiro Iwamatsu <iwamatsu@nigauri.org>
Thu, 6 Jan 2011 01:23:54 +0000 (10:23 +0900)
committerWolfgang Denk <wd@denx.de>
Tue, 25 Jan 2011 21:22:30 +0000 (22:22 +0100)
Linker needs to use the proper endian/bfd flags even when doing partial linking.
LDFLAGS_u-boot sets linker option which is called it when U-boot is built
(u-boot final).
LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).

CC: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Makefile
arch/blackfin/config.mk
arch/i386/config.mk
arch/nios2/config.mk
arch/powerpc/config.mk
arch/sh/config.mk
arch/sh/cpu/sh2/config.mk
config.mk

index fd21ef3cff3b35ffdd4c183a8c400136738a1376..5f93646994ef863c68d72c0234c638172f3a0346 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -369,7 +369,7 @@ $(obj)u-boot.dis:   $(obj)u-boot
 GEN_UBOOT = \
                UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
                sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
-               cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
+               cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__OBJS) \
                        --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
                        -Map u-boot.map -o u-boot
 $(obj)u-boot:  depend \
index ab117ca5ad5227314b4619dc310d7d47413a5847..0cba294e734d6082fa5676734a273ee1f45c8fcb 100644 (file)
@@ -30,7 +30,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 += --gc-sections -m elf32bfin
+LDFLAGS_u-boot += --gc-sections
+LDFLAGS += -m elf32bfin
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 
 PLATFORM_CPPFLAGS += -DBFIN_CPU='"$(CONFIG_BFIN_CPU)"'
index 8743f1a66320fcadef963da026d044dddf8f1fab..3fb97c1989bd62ae2040c7ace274a78f75b690a0 100644 (file)
@@ -35,5 +35,6 @@ PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector)
 PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2)
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
 
-LDFLAGS += --cref --gc-sections
+LDFLAGS += --cref
+LDFLAGS_u-boot += --gc-sections
 PLATFORM_RELFLAGS += -ffunction-sections
index aba96b30199346c03749f7f0e2523accd0af7986..fa93180f301ac333448a435d5805d7ad7a97f16d 100644 (file)
@@ -31,5 +31,5 @@ PLATFORM_CPPFLAGS += -G0
 
 LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
 
-LDFLAGS += --gc-sections
+LDFLAGS_u-boot += --gc-sections
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
index 2912604afcb1a388554736be5a3d4134153b496e..64191c78f18e4fb2f613871d10a5d7c2872740d4 100644 (file)
 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
 
 ifdef CONFIG_SYS_LDSCRIPT
 # need to strip off double quotes
index 415c94979848f6980e6457200b46f05baf271308..4ef85e3e5de74ffc139e44bbb7b5562a89a2c56f 100644 (file)
@@ -30,5 +30,5 @@ 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
 LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
index 52d5a0f4d54b9a9d9b2e2d4092d84a5f6ddcd0f5..f2d40aa22872302c91c0d1364854911b204fc81f 100644 (file)
@@ -21,6 +21,8 @@
 # MA 02111-1307 USA
 #
 #
+ENDIANNESS += -EB
+
 PLATFORM_CPPFLAGS += -m3e -mb
 PLATFORM_RELFLAGS += -ffixed-r13
-PLATFORM_LDFLAGS += -EB
+PLATFORM_LDFLAGS += $(ENDIANNESS)
index 66f8fe67f73d89cc7edb41db4eb3724ba21b4a26..5147c3568b83fc879c2f5fb92e0cacc68c0e9624 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -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
@@ -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 $@ )
 
 #########################################################################