All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Makefile: Fix linking with modern binutils
Date: Fri, 9 Dec 2016 09:23:52 -0500	[thread overview]
Message-ID: <20161209142352.GA22675@bill-the-cat> (raw)
In-Reply-To: <20161208032251.8774-1-joel@jms.id.au>

On Thu, Dec 08, 2016 at 02:22:51PM +1100, Joel Stanley wrote:

> 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 reproduced 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. While version 2.26 and 2.27 will not show this
> error, we are technically creating invalid ELF files without this
> option.
> 
> 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>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  Makefile | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index dfed58bec661..0bfd57d81646 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -792,7 +792,11 @@ ifneq ($(CONFIG_BUILD_TARGET),)
>  ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
>  endif
>  
> -LDFLAGS_u-boot += $(LDFLAGS_FINAL)
> +# Avoid Not enough room for program headers on binutils 2.28 onwards.
> +# Flag was introduced in 2.26
> +LDFLAGS_u-boot += $(LDFLAGS_FINAL) \
> +	$(call ld-ifversion, -ge, 22600000, --no-dynamic-linker)

This breaks on things like:
$ arm-none-eabi-ld --version
GNU ld (GNU Tools for ARM Embedded Processors) 2.24.0.20150921

so please use ld-option instead to add this when supported, 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/20161209/6470de6b/attachment.sig>

  parent reply	other threads:[~2016-12-09 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08  3:22 [U-Boot] [PATCH] Makefile: Fix linking with modern binutils Joel Stanley
2016-12-08  4:52 ` Alan Modra
2016-12-08 22:22 ` Simon Glass
2016-12-09 14:23 ` Tom Rini [this message]
2016-12-13  5:01   ` [U-Boot] " Joel Stanley
2016-12-13 12:21     ` Tom Rini
2016-12-16  4:53       ` Joel Stanley
2016-12-13 13:15     ` Måns Rullgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209142352.GA22675@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.