mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Linking issue with ld.bfd 2.28.0.20170307
@ 2017-03-30 18:49 Holger Freyther
  2017-04-17  5:35 ` Holger Freyther
  0 siblings, 1 reply; 5+ messages in thread
From: Holger Freyther @ 2017-03-30 18:49 UTC (permalink / raw)
  To: barebox

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.

cheers
	holger

   arm-poky-linux-gnueabi-ld.bfd     -r -o common/built-in.o common/memory.o common/memory_display.o common/clock.o common/console_common.o common/startup.o common/misc.o common/resource.o common/bootsource.o common/restart.o common/complete.o common/version.o common/binfmt.o common/bootm.o common/memtest.o common/command.o common/console.o common/console_countdown.o common/environment.o common/env.o common/filetype.o common/bootargs.o common/globalvar.o common/date.o common/kallsyms.o common/dlmalloc.o common/meminfo.o common/oftree.o common/password.o common/poller.o common/hush.o common/state/built-in.o common/image.o common/uimage.o common/imd.o common/ubiformat.o common/boot.o common/memsize.o
   arm-poky-linux-gnueabi-ld.bfd     -r -o common/built-in-pbl.o common/pbl-imd-barebox.o common/pbl-memsize.o common/state/built-in-pbl.o
  arm-poky-linux-gnueabi-ld.bfd    -Map barebox.map --gc-sections -pie -o .tmp_barebox1 -T arch/arm/lib32/barebox.lds --start-group  common/built-in.o  drivers/built-in.o  commands/built-in.o  lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o  arch/arm/boards/built-in.o  arch/arm/mach-davinci/built-in.o  arch/arm/cpu/built-in.o  arch/arm/lib/built-in.o  arch/arm/lib32/built-in.o  arch/arm/crypto/built-in.o  arch/arm/dts/built-in.o  pbl/built-in.o  defaultenv/built-in.o --end-group 
arm-poky-linux-gnueabi-ld.bfd: .tmp_barebox1: Not enough room for program headers, try linking with -N
arm-poky-linux-gnueabi-ld.bfd: final link failed: Bad value

/*
 *
 * Automatically generated file; DO NOT EDIT.
 * Barebox/arm 2017.03.0 Configuration
 *
 */
/*
 * Helper macros to use CONFIG_ options in C expressions. Note that
 * these only work with boolean and tristate options.
 */
/*
 * Getting something that works in C and CPP for an arg that may or may
 * not be defined is tricky.  Here, if we have "#define CONFIG_BOOGER 1"
 * we match on the placeholder define, insert the "0," for arg1 and generate
 * the triplet (0, 1, 0).  Then the last step cherry picks the 2nd arg (a one).
 * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when
 * the last step cherry picks the 2nd arg, we get a zero.
 */
/*
 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
 * 0 otherwise.
 *
 */
/*
 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
 * otherwise. For boolean options, this is equivalent to
 * IS_ENABLED(CONFIG_FOO).
 */
/*
 * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0
 * otherwise.
 */
/*
 * (C) Copyright 2000-2004
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 *
 */
/*
 * Align to a 32 byte boundary equal to the
 * alignment gcc 4.5 uses for a struct
 */
/* Indirect stringification.  Doing two levels allows the parameter to be a
 * macro itself.  For example, compile with -DFOO=bar, __stringify(FOO)
 * converts to "bar".
 */
/* use 2 ASSERT because ld can not accept '"size" "10"' format */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(start)
SECTIONS
{
 . = 0x0;
 .image_start : { *(.__image_start) }
 . = ALIGN(4);
 .text :
 {
  _stext = .;
  _text = .;
  *(.text_entry*)
  __bare_init_start = .;
  *(.text_bare_init*)
  __bare_init_end = .;
  . = ALIGN(0x20);
  __exceptions_start = .;
  KEEP(*(.text_exceptions*))
  __exceptions_stop = .;
  *(.text*)
 }
 _barebox_bare_init_size = __bare_init_end - _text; ASSERT(_barebox_bare_init_size < 0xffffffff, "Barebox bare_init size > ") ASSERT(_barebox_bare_init_size < 0xffffffff, "0xffffffff"
)
 . = ALIGN(4);
 .rodata : { *(.rodata*) }
 /*
         * Stack unwinding tables
         */
 . = ALIGN(8);
 .ARM.unwind_idx : {
  __start_unwind_idx = .;
  *(.ARM.exidx*)
  __stop_unwind_idx = .;
 }
 .ARM.unwind_tab : {
  __start_unwind_tab = .;
  *(.ARM.extab*)
  *(.ARM.extab*)
  __stop_unwind_tab = .;
 }
 _etext = .; /* End of text and rodata section */
 _sdata = .;
 . = ALIGN(4);
 .data : { *(.data*) }
 .barebox_imd : { KEEP(*(.barebox_imd_start)) KEEP(*(.barebox_imd_1*)) *(.barebox_imd_0*) KEEP(*(.barebox_imd_end)) }
 . = .;
 __barebox_cmd_start = .;
 .barebox_cmd : { KEEP(*(SORT_BY_NAME(.barebox_cmd*))) }
 __barebox_cmd_end = .;
 __barebox_magicvar_start = .;
 .barebox_magicvar : { KEEP(*(SORT_BY_NAME(.barebox_magicvar*))) }
 __barebox_magicvar_end = .;
 __barebox_initcalls_start = .;
 .barebox_initcalls : { KEEP(*(.initcall.0)) KEEP(*(.initcall.1)) KEEP(*(.initcall.2)) KEEP(*(.initcall.3)) KEEP(*(.initcall.4)) KEEP(*(.initcall.5)) KEEP(*(.initcall.6)) KEEP(*(.initcall.7)) KEEP(*(.initcall.8)) KEEP(*(.initcall.9)) KEEP(*(.initcall.10)) KEEP(*(.initcall.11)) KEEP(*(.initcall.12)) KEEP(*(.initcall.13)) KEEP(*(.initcall.14)) }
 __barebox_initcalls_end = .;
 __barebox_exitcalls_start = .;
 .barebox_exitcalls : { KEEP(*(.exitcall.0)) KEEP(*(.exitcall.1)) KEEP(*(.exitcall.2)) KEEP(*(.exitcall.3)) KEEP(*(.exitcall.4)) KEEP(*(.exitcall.5)) KEEP(*(.exitcall.6)) }
 __barebox_exitcalls_end = .;
 __usymtab_start = .;
 __usymtab : { KEEP(*(__usymtab)) }
 __usymtab_end = .;
 .oftables : { . = ALIGN(8); __clk_of_table_start = .; KEEP(*(.__clk_of_table)); KEEP(*(.__clk_of_table_end)); __clk_of_table_end = .; }
 .dtb : { . = ALIGN(8); __dtb_start = .; KEEP(*(.dtb.rodata.*)); __dtb_end = .; }
 .rel.dyn : {
  __rel_dyn_start = .;
  *(.rel*)
  __rel_dyn_end = .;
 }
 .dynsym : {
  __dynsym_start = .;
  *(.dynsym)
  __dynsym_end = .;
 }
 _edata = .;
 .image_end : { *(.__image_end) }
 . = ALIGN(4);
 __bss_start = .;
 .bss : { *(.bss*) }
 __bss_stop = .;
 _end = .;
 _barebox_image_size = __bss_start - 0x82000000;
}


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linking issue with ld.bfd 2.28.0.20170307
  2017-03-30 18:49 Linking issue with ld.bfd 2.28.0.20170307 Holger Freyther
@ 2017-04-17  5:35 ` Holger Freyther
  2017-04-19 10:31   ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Holger Freyther @ 2017-04-17  5:35 UTC (permalink / raw)
  To: barebox


> 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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linking issue with ld.bfd 2.28.0.20170307
  2017-04-17  5:35 ` Holger Freyther
@ 2017-04-19 10:31   ` Sascha Hauer
  2017-04-19 19:30     ` Панов Андрей
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2017-04-19 10:31 UTC (permalink / raw)
  To: Holger Freyther; +Cc: barebox

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linking issue with ld.bfd 2.28.0.20170307
  2017-04-19 10:31   ` Sascha Hauer
@ 2017-04-19 19:30     ` Панов Андрей
  2017-04-21  9:54       ` Holger Freyther
  0 siblings, 1 reply; 5+ messages in thread
From: Панов Андрей @ 2017-04-19 19:30 UTC (permalink / raw)
  To: Sascha Hauer, Holger Freyther; +Cc: barebox

[-- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linking issue with ld.bfd 2.28.0.20170307
  2017-04-19 19:30     ` Панов Андрей
@ 2017-04-21  9:54       ` Holger Freyther
  0 siblings, 0 replies; 5+ messages in thread
From: Holger Freyther @ 2017-04-21  9:54 UTC (permalink / raw)
  To: Панов
	Андрей
  Cc: barebox


> On 19. Apr 2017, at 21:30, Панов Андрей <rockford@yandex.ru> wrote:
> 
> 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.


Thank you!

Passing --no-dynamic does link the barebox binary. I will try to test the resulting binary soon.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-21  9:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 18:49 Linking issue with ld.bfd 2.28.0.20170307 Holger Freyther
2017-04-17  5:35 ` Holger Freyther
2017-04-19 10:31   ` Sascha Hauer
2017-04-19 19:30     ` Панов Андрей
2017-04-21  9:54       ` Holger Freyther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox