* [U-Boot] [PATCH v3] Makefile: Fix linking with modern binutils
@ 2017-04-09 18:33 Andreas Färber
2017-04-10 1:02 ` [U-Boot] [U-Boot, " Vagrant Cascadian
2017-04-10 18:26 ` [U-Boot] [PATCH " Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Färber @ 2017-04-09 18:33 UTC (permalink / raw)
To: u-boot
From: Joel Stanley <joel@jms.id.au>
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>
---
Makefile | 4 ++++
scripts/Makefile.spl | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index ca7d60d..09b597d 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
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 760acee..eb24292 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -291,6 +291,10 @@ $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
$(call if_changed,objcopy)
LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
+
+# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
+LDFLAGS_$(SPL_BIN) += $(call ld-option, --no-dynamic-linker)
+
ifneq ($(CONFIG_SPL_TEXT_BASE),)
LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
endif
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [U-Boot, v3] Makefile: Fix linking with modern binutils
2017-04-09 18:33 [U-Boot] [PATCH v3] Makefile: Fix linking with modern binutils Andreas Färber
@ 2017-04-10 1:02 ` Vagrant Cascadian
2017-04-10 18:26 ` [U-Boot] [PATCH " Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Vagrant Cascadian @ 2017-04-10 1:02 UTC (permalink / raw)
To: u-boot
On 2017-04-09, Andreas Färber <afaerber@suse.de> wrote:
> From: Joel Stanley <joel@jms.id.au>
>
> 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.
Also been hitting this with Debian's cross-toolchains (currently
binutils 2.28-3), but only when cross-building the firefly-rk3288 with
binutils-arm-linux-gnueabihf target. Other targets build fine...
This patch does appear to fix or workaround the issue for me, though,
thanks!
live well,
vagrant
> [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>
> ---
> Makefile | 4 ++++
> scripts/Makefile.spl | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index ca7d60d..09b597d 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
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 760acee..eb24292 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -291,6 +291,10 @@ $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
> $(call if_changed,objcopy)
>
> LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
> +
> +# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
> +LDFLAGS_$(SPL_BIN) += $(call ld-option, --no-dynamic-linker)
> +
> ifneq ($(CONFIG_SPL_TEXT_BASE),)
> LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
> endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170409/2f5caf42/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v3] Makefile: Fix linking with modern binutils
2017-04-09 18:33 [U-Boot] [PATCH v3] Makefile: Fix linking with modern binutils Andreas Färber
2017-04-10 1:02 ` [U-Boot] [U-Boot, " Vagrant Cascadian
@ 2017-04-10 18:26 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2017-04-10 18:26 UTC (permalink / raw)
To: u-boot
On Sun, Apr 09, 2017 at 08:33:58PM +0200, Andreas Färber wrote:
> From: Joel Stanley <joel@jms.id.au>
>
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/595ff43e/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-10 18:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09 18:33 [U-Boot] [PATCH v3] Makefile: Fix linking with modern binutils Andreas Färber
2017-04-10 1:02 ` [U-Boot] [U-Boot, " Vagrant Cascadian
2017-04-10 18:26 ` [U-Boot] [PATCH " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.