summaryrefslogtreecommitdiff
path: root/config.mk
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-08-17 14:00:53 +0200
committerWolfgang Denk <wd@denx.de>2009-08-21 23:13:34 +0200
commit1aada9cd643567d351667138851e9231ccfa245a (patch)
treed307bc75577677a3fdf1d3e3ccd075287977a24f /config.mk
parentf772acf8a584067033eff1e231fcd1fb3a00d3d9 (diff)
downloadu-boot-1aada9cd643567d351667138851e9231ccfa245a.tar.gz
u-boot-1aada9cd643567d351667138851e9231ccfa245a.tar.bz2
u-boot-1aada9cd643567d351667138851e9231ccfa245a.zip
Fix all linker scripts for older binutils versions (pre-2.16)
Commit f62fb99941c6 fixed handling of all rodata sections by using a wildcard combined with calls to ld's builtin functions SORT_BY_ALIGNMENT() and SORT_BY_NAME(). Unfortunately these functions were only introduced with biunutils version 2.16, so the modification broke building with all tool chains using older binutils. This patch makes it work again. This is done by omitting the use of these functions for such old tool chains. This will result in slightly larger target binaries, as the rodata sections are no longer in optimal order alignment-wise which reauls in unused gaps, but the effect was found to be insignificant - especially compared to the fact that you cannot build U-Boot at all in the current state. As ld seems to have no support for conditionals we run the linker script through the C preprocessor which can be easily used to remove the unwanted function calls. Note that the C preprocessor must be run with the "-ansi" (or a "-std=") option to make sure all the system-specific predefined macros outside the reserved namespace are suppressed. Otherise, cpp might for example substitute "powerpc" to "1", thus corrupting for example "OUTPUT_ARCH(powerpc)" etc. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'config.mk')
-rw-r--r--config.mk12
1 files changed, 11 insertions, 1 deletions
diff --git a/config.mk b/config.mk
index 0c6d1d1aa7..7bc7315d5d 100644
--- a/config.mk
+++ b/config.mk
@@ -166,11 +166,21 @@ endif
AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
-LDFLAGS += -Bstatic -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
+LDFLAGS += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
ifneq ($(TEXT_BASE),)
LDFLAGS += -Ttext $(TEXT_BASE)
endif
+# Special flags for CPP when processing the linker script
+# Linker versions prior to 2.16 don't understand the builting
+# functions SORT_BY_ALIGNMENT() and SORT_BY_NAME(), so disable these
+ifeq ($(shell $(LD) -v | \
+ sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\) .*/[ \1 -lt 2 ] || [ \2 -lt 16 ] \&\& echo old_ld/p' | \
+ sh),old_ld)
+LDPPFLAGS += -D'SORT_BY_ALIGNMENT(x)=x' -D'SORT_BY_NAME(x)=x'
+endif
+
+
# Location of a usable BFD library, where we define "usable" as
# "built for ${HOST}, supports ${TARGET}". Sensible values are
# - When cross-compiling: the root of the cross-environment