summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2017-04-09 20:33:58 +0200
committerTom Rini <trini@konsulko.com>2017-04-10 08:06:48 -0400
commite391b1e64b0bd65709a28a4764afe4f32d408243 (patch)
treea7ed9072fb2a0ef35661625384ef57104c763ae5 /Makefile
parent4d0f0a4183e2e1a5cbcaa1faf8229a5cd11b0428 (diff)
downloadu-boot-e391b1e64b0bd65709a28a4764afe4f32d408243.tar.gz
u-boot-e391b1e64b0bd65709a28a4764afe4f32d408243.tar.xz
u-boot-e391b1e64b0bd65709a28a4764afe4f32d408243.zip
Makefile: Fix linking with modern binutils
Since Binutils 1a9ccd70f9a7[1] u-boot will not link targets that set CONFIG_SYS_TEXT_BASE=0 with the following error: LD u-boot arm-linux-gnueabi-ld.bfd: u-boot: Not enough room for program headers, try linking with -N arm-linux-gnueabi-ld.bfd: final link failed: Bad value The issue can be reproduced with the bad binutils and the rock2_defconfig target. This issue was also encountered by the powerpc kernel[2], with the fix being to pass --no-dynamic-linker for linkers newer than 2.26 when this flag was introduced. The option tells ld that the PIE or shared lib does not need loaded program headers. Ubuntu Zesty's Binutils 2.27.51.20161202 hits this error. [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=1a9ccd70f9a7 [2] https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=ff45000fcb56b5b0f1a14a865d3541746d838a0a Signed-off-by: Joel Stanley <joel@jms.id.au> [AF: Apply to LDFLAGS_$(SPL_BIN) as well, suggested by Tom Rini] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ca7d60d610..09b597d450 100644
--- a/Makefile
+++ b/Makefile
@@ -805,6 +805,10 @@ ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL)
+
+# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
+LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker)
+
ifneq ($(CONFIG_SYS_TEXT_BASE),)
LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
endif