mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Панов Андрей" <rockford@yandex.ru>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Holger Freyther <holger@moiji-mobile.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: Linking issue with ld.bfd 2.28.0.20170307
Date: Wed, 19 Apr 2017 22:30:53 +0300	[thread overview]
Message-ID: <417131492630253@web37j.yandex.ru> (raw)
In-Reply-To: <20170419103108.bmocd6whapavxs4q@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]

Hi!

U-boot has fix for this issue:
http://git.denx.de/?p=u-boot.git;a=commit;h=e391b1e64b0bd65709a28a4764afe4f32d408243

With attached patch I was able to build barebox with new ld. Tested on imx6 arch only.


19.04.2017, 13:31, "Sascha Hauer" <s.hauer@pengutronix.de>:
> Hi Holger,
>
> On Mon, Apr 17, 2017 at 07:35:19AM +0200, Holger Freyther wrote:
>>  > On 30. Mar 2017, at 20:49, Holger Freyther <holger@moiji-mobile.com> wrote:
>>  >
>>  > Hi,
>>
>>  Hi!
>>
>>  > I am rebuilding the bootloader with gcc6 and the above version
>>  > of binutils and it is failing to link with .bfd but is working
>>  > with .gold.
>>  >
>>  > Is this known? Is anyone else seeing this issue? And no I did
>>  > not try linking with -N and I have no idea what ld thinks is
>>  > the program headers here.
>>
>>  my steps to reproduce this with Yocto's gcc-6.3 and ld.bfd
>>  2.28.0.20170307 are the following. CROSS_COMPILE points into
>>  the sysroot of a build on poky master.
>>
>>  git clone --branch=hfreyther/v2017.03-rebase git://git.sysmocom.de/barebox
>>  cd barebox/
>>  wget -O .config "http://git.sysmocom.de/poky/meta-sysmocom-bsp/plain/recipes-bsp/barebox/barebox-sysmobts/defconfig?id=39afcd35ae40b8468868f1e942706dec11e03961"
>>  make ARCH=arm
>>
>>  .../arm-poky-linux-gnueabi-ld: .tmp_barebox1: Not enough room for program headers, try linking with -N
>>  .../arm-poky-linux-gnueabi-ld: final link failed: Bad value
>
> I'm afraid nobody currently uses gcc6 for barebox. I have no idea what's
> going wrong here, sorry. Does it work when you disable
> CONFIG_RELOCATABLE?
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Андрей

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-linking-with-new-ld-based-on-u-boot.patch --]
[-- Type: text/x-diff; name="0001-Fix-linking-with-new-ld-based-on-u-boot.patch", Size: 1957 bytes --]

From fc6dd69d33e3e3285d7efe1647af8f1ae3194846 Mon Sep 17 00:00:00 2001
From: Andrey Panov <rockford@yandex.ru>
Date: Wed, 19 Apr 2017 22:25:17 +0300
Subject: [PATCH] Fix linking with new ld, based on u-boot

---
 Makefile               | 3 +++
 images/Makefile        | 3 +++
 scripts/Kbuild.include | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index afa4bf802..c78f66f73 100644
--- a/Makefile
+++ b/Makefile
@@ -306,6 +306,9 @@ AFLAGS          := -D__ASSEMBLY__
 
 LDFLAGS_barebox	:= -Map barebox.map
 
+# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
+LDFLAGS_barebox += $(call ld-option, --no-dynamic-linker)
+
 # Read KERNELRELEASE from include/config/kernel.release (if it exists)
 KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
diff --git a/images/Makefile b/images/Makefile
index adf950aa9..8c5dac4bf 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -53,6 +53,9 @@ extra-y += $(pbl-lds)
 $(pbl-lds): $(obj)/../arch/$(ARCH)/lib/pbl.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
 
+# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
+LDFLAGS += $(call ld-option, --no-dynamic-linker)
+
 quiet_cmd_elf__ ?= LD      $@
       cmd_elf__ ?= $(LD) $(LDFLAGS) --gc-sections -pie			\
 		-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@		\
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index c7faf67a2..310dcdc94 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -148,7 +148,7 @@ cc-ldoption = $(call try-run,\
 # ld-option
 # Usage: LDFLAGS += $(call ld-option, -X)
 ld-option = $(call try-run,\
-	$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+	$(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
 
 # ar-option
 # Usage: KBUILD_ARFLAGS := $(call ar-option,D)
-- 
2.11.0


[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-04-19 19:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 18:49 Holger Freyther
2017-04-17  5:35 ` Holger Freyther
2017-04-19 10:31   ` Sascha Hauer
2017-04-19 19:30     ` Панов Андрей [this message]
2017-04-21  9:54       ` Holger Freyther

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=417131492630253@web37j.yandex.ru \
    --to=rockford@yandex.ru \
    --cc=barebox@lists.infradead.org \
    --cc=holger@moiji-mobile.com \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox