Skip to contentSkip to conversation

armv7: fix linker file for newer ld support

PATCH New Alexander Holler 4 participants 10 messages Nov 2, 2010 – Nov 3, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

---
 arch/arm/cpu/armv7/u-boot.lds |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
arch/arm/cpu/armv7/u-boot.lds +8 -7
index 88a0fec..34e0a79 100644
@@ -54,13 +54,6 @@ SECTIONS
 		*(.data.rel.ro)
 	}
 	. = ALIGN(4);
-	__rel_dyn_start = .;
-	.rel.dyn : { *(.rel.dyn) }
-	__rel_dyn_end = .;
-
-	__dynsym_start = .;
-	.dynsym : { *(.dynsym) }
-
 	__got_start = .;
 	. = ALIGN(4);
 	.got : { *(.got) }
@@ -74,4 +67,12 @@ SECTIONS
 	__bss_start = .;
 	.bss : { *(.bss) }
 	_end = .;
+
+	. = ALIGN(4);
+	__rel_dyn_start = .;
+	.rel.dyn : { *(.rel*) }
+	__rel_dyn_end = .;
+
+	__dynsym_start = .;
+	.dynsym : { *(.dynsym) }
 }
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Quoted 27 lines · Alexander Holler

---
?arch/arm/cpu/armv7/u-boot.lds | ? 15 ++++++++------- ?1 files changed, 8 insertions(+), 7 deletions(-)

arch/arm/cpu/armv7/u-boot.lds +0 -7
index 88a0fec..34e0a79 100644
@@ -54,13 +54,6 @@ SECTIONS
 ? ? ? ? ? ? ? ?*(.data.rel.ro)
 ? ? ? ?}
 ? ? ? ?. = ALIGN(4);
- ? ? ? __rel_dyn_start = .;
- ? ? ? .rel.dyn : { *(.rel.dyn) }
- ? ? ? __rel_dyn_end = .;
-
- ? ? ? __dynsym_start = .;
- ? ? ? .dynsym : { *(.dynsym) }
-
 ? ? ? ?__got_start = .;
 ? ? ? ?. = ALIGN(4);
 ? ? ? ?.got : { *(.got) }
@@ -74,4 +67,12 @@ SECTIONS
 ? ? ? ?__bss_start = .;
 ? ? ? ?.bss : { *(.bss) }
 ? ? ? ?_end = .;

arch/arm/cpu/armv7/u-boot.lds SECTIONS

Quoted 10 lines
arch/arm/cpu/armv7/u-boot.lds +8 -1
+
+ ? ? ? . = ALIGN(4);
+ ? ? ? __rel_dyn_start = .;
+ ? ? ? .rel.dyn : { *(.rel*) }
+ ? ? ? __rel_dyn_end = .;
+
+ ? ? ? __dynsym_start = .;
+ ? ? ? .dynsym : { *(.dynsym) }
 ?}
--

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Steve

#2 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Le 02/11/2010 05:05, Steve Sakoman a ?crit :

Quoted 9 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Steve

Thanks for pointing this out, Steve. That'll go into V3 of my patch set I guess, as Alexander's patch derives from mine and I most probably hit the same size increase issue as he does.

Wolfgang: that may mean the tx25 config file patch is unneeded. Stay tuned.

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Quoted 10 lines · Albert ARIBAUD

Le 02/11/2010 05:05, Steve Sakoman a ?crit :

Quoted 8 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Quoted 7 lines
Quoted 1 line

Steve

Thanks for pointing this out, Steve. That'll go into V3 of my patch set I guess, as Alexander's patch derives from mine and I most probably hit the same size increase issue as he does.

Wolfgang: that may mean the tx25 config file patch is unneeded. Stay tuned.

I should have stated that I was using gcc 4.3.3 and binutils 2.18.50, since indeed it does seem to be binutils related.

I have had a couple of reports that the following patch works with recent gcc/binutils without increasing the size of the binary.

Could others check and report results?

Steve

ARMV7: Fix build issue with recent versions of gcc/binutils
---

arch/arm/cpu/armv7/u-boot.lds +1 -1
index 88a0fec..e690b58 100644
@@ -55,7 +55,7 @@ SECTIONS
 	}
 	. = ALIGN(4);
 	__rel_dyn_start = .;
-	.rel.dyn : { *(.rel.dyn) }
+	.rel.dyn : { *(.rel.*) }
 	__rel_dyn_end = .;
 
 	__dynsym_start = .;
#4 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Le 02/11/2010 14:08, Steve Sakoman a ?crit :

Quoted 38 lines · Albert ARIBAUD
Quoted 10 lines

Le 02/11/2010 05:05, Steve Sakoman a ?crit :

Quoted 8 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Quoted 7 lines
Quoted 1 line

Steve

Thanks for pointing this out, Steve. That'll go into V3 of my patch set I guess, as Alexander's patch derives from mine and I most probably hit the same size increase issue as he does.

Wolfgang: that may mean the tx25 config file patch is unneeded. Stay tuned.

I should have stated that I was using gcc 4.3.3 and binutils 2.18.50, since indeed it does seem to be binutils related.

I have had a couple of reports that the following patch works with recent gcc/binutils without increasing the size of the binary.

Could others check and report results?

Steve

ARMV7: Fix build issue with recent versions of gcc/binutils
---

arch/arm/cpu/armv7/u-boot.lds +0 -0
index 88a0fec..e690b58 100644

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 61

Quoted 8 lines
arch/arm/cpu/armv7/u-boot.lds +1 -1
@@ -55,7 +55,7 @@ SECTIONS
  	}
  	. = ALIGN(4);
  	__rel_dyn_start = .;
-	.rel.dyn : { *(.rel.dyn) }
+	.rel.dyn : { *(.rel.*) }
  	__rel_dyn_end = .;
 
  	__dynsym_start = .;

Weird... This patch seems indeed more restrictive than mine, but the input sections collected in .rel.dyn are actually the same for both.

We can gain a bit less than 60k by overlapping .bss and .rel.dyn, but certainly not 200k!

OTOH, it happened during my 'cross-build' tests (using one chain's gcc with another chain's ld) that the resulting u-boot was drastically reduced; but I chalked that to my misusing of the build tools.

Steve, can you indicate which toolchain excatly exhibits the 230k-to-430k issue, and which board I should build?

Amicalement,

Signature · 1 line
Albert.
#5 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Quoted 58 lines · Albert ARIBAUD

Le 02/11/2010 14:08, Steve Sakoman a ?crit :

Quoted 42 lines
Quoted 11 lines · On Tue, Nov 2, 2010 at 12:48 AM, Albert ARIBAUD<[email protected]> ?wrote:

Le 02/11/2010 05:05, Steve Sakoman a ?crit :

Quoted 8 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Quoted 8 lines
Quoted 1 line

Steve

Thanks for pointing this out, Steve. That'll go into V3 of my patch set I guess, as Alexander's patch derives from mine and I most probably hit the same size increase issue as he does.

Wolfgang: that may mean the tx25 config file patch is unneeded. Stay tuned.

I should have stated that I was using gcc 4.3.3 and binutils 2.18.50, since indeed it does seem to be binutils related.

I have had a couple of reports that the following patch works with recent gcc/binutils without increasing the size of the binary.

Could others check and report results?

Steve

ARMV7: Fix build issue with recent versions of gcc/binutils
---

arch/arm/cpu/armv7/u-boot.lds +0 -0
index 88a0fec..e690b58 100644

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 61

Quoted 8 lines
arch/arm/cpu/armv7/u-boot.lds +1 -1
@@ -55,7 +55,7 @@ SECTIONS
 ? ? ? ?}
 ? ? ? ?. = ALIGN(4);
 ? ? ? ?__rel_dyn_start = .;
- ? ? ? .rel.dyn : { *(.rel.dyn) }
+ ? ? ? .rel.dyn : { *(.rel.*) }
 ? ? ? ?__rel_dyn_end = .;
 
 ? ? ? ?__dynsym_start = .;

Weird... This patch seems indeed more restrictive than mine, but the input sections collected in .rel.dyn are actually the same for both.

We can gain a bit less than 60k by overlapping .bss and .rel.dyn, but certainly not 200k!

Quoted 6 lines

OTOH, it happened during my 'cross-build' tests (using one chain's gcc with another chain's ld) that the resulting u-boot was drastically reduced; but I chalked that to my misusing of the build tools.

Steve, can you indicate which toolchain excatly exhibits the 230k-to-430k issue, and which board I should build?

I used gcc 4.3.3 and binutils 2.18.50 and built beagle and overo.

Steve

#6 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

In reply to Albert ARIBAUD
Quoted 54 lines · Albert ARIBAUD

Le 02/11/2010 14:08, Steve Sakoman a ?crit :

Quoted 38 lines · Albert ARIBAUD
Quoted 10 lines

Le 02/11/2010 05:05, Steve Sakoman a ?crit :

Quoted 8 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Quoted 7 lines
Quoted 1 line

Steve

Thanks for pointing this out, Steve. That'll go into V3 of my patch set I guess, as Alexander's patch derives from mine and I most probably hit the same size increase issue as he does.

Wolfgang: that may mean the tx25 config file patch is unneeded. Stay tuned.

I should have stated that I was using gcc 4.3.3 and binutils 2.18.50, since indeed it does seem to be binutils related.

I have had a couple of reports that the following patch works with recent gcc/binutils without increasing the size of the binary.

Could others check and report results?

Steve

ARMV7: Fix build issue with recent versions of gcc/binutils
---

arch/arm/cpu/armv7/u-boot.lds +0 -0
index 88a0fec..e690b58 100644

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 61

Quoted 8 lines
arch/arm/cpu/armv7/u-boot.lds +1 -1
@@ -55,7 +55,7 @@ SECTIONS
  	}
  	. = ALIGN(4);
  	__rel_dyn_start = .;
-	.rel.dyn : { *(.rel.dyn) }
+	.rel.dyn : { *(.rel.*) }
  	__rel_dyn_end = .;
 
  	__dynsym_start = .;

Weird... This patch seems indeed more restrictive than mine, but the input sections collected in .rel.dyn are actually the same for both.

We can gain a bit less than 60k by overlapping .bss and .rel.dyn, but certainly not 200k!

Quoted 6 lines

OTOH, it happened during my 'cross-build' tests (using one chain's gcc with another chain's ld) that the resulting u-boot was drastically reduced; but I chalked that to my misusing of the build tools.

Steve, can you indicate which toolchain excatly exhibits the 230k-to-430k issue, and which board I should build?

The problem is that the first patch posted here places .rel.dyn after .bss, so when dumping u-boot.img, all of .bss is included in the file. Keeping it before .bss allows the flat binary to omit .bss as usual.

Using the patch quoted above, I get a working u-boot from all combinations of gcc and binutils I cared to try, including gcc 4.5-linaro with binutils 2.20.1.

Signature · 2 lines
M?ns Rullg?rd
mans at mansr.com
#7 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Le 02/11/2010 18:00, M?ns Rullg?rd a ?crit :

Quoted 60 lines
Quoted 58 lines · Albert ARIBAUD

Le 02/11/2010 14:08, Steve Sakoman a ?crit :

Quoted 38 lines · Albert ARIBAUD
Quoted 10 lines

Le 02/11/2010 05:05, Steve Sakoman a ?crit :

Quoted 8 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

I tested this patch using gcc 4.3.3, and while it produces a usable image, it causes the size of the image to grow from 227K to 433K!

So perhaps we need a patch that uses a more restrictive wildcard.

Quoted 7 lines
Quoted 1 line

Steve

Thanks for pointing this out, Steve. That'll go into V3 of my patch set I guess, as Alexander's patch derives from mine and I most probably hit the same size increase issue as he does.

Wolfgang: that may mean the tx25 config file patch is unneeded. Stay tuned.

I should have stated that I was using gcc 4.3.3 and binutils 2.18.50, since indeed it does seem to be binutils related.

I have had a couple of reports that the following patch works with recent gcc/binutils without increasing the size of the binary.

Could others check and report results?

Steve

ARMV7: Fix build issue with recent versions of gcc/binutils
---

arch/arm/cpu/armv7/u-boot.lds +0 -0
index 88a0fec..e690b58 100644

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 61

Quoted 8 lines
arch/arm/cpu/armv7/u-boot.lds +1 -1
@@ -55,7 +55,7 @@ SECTIONS
   	}
   	. = ALIGN(4);
   	__rel_dyn_start = .;
-	.rel.dyn : { *(.rel.dyn) }
+	.rel.dyn : { *(.rel.*) }
   	__rel_dyn_end = .;
 
   	__dynsym_start = .;

Weird... This patch seems indeed more restrictive than mine, but the input sections collected in .rel.dyn are actually the same for both.

We can gain a bit less than 60k by overlapping .bss and .rel.dyn, but certainly not 200k!

OTOH, it happened during my 'cross-build' tests (using one chain's gcc with another chain's ld) that the resulting u-boot was drastically reduced; but I chalked that to my misusing of the build tools.

Quoted 6 lines
Quoted 2 lines

Steve, can you indicate which toolchain excatly exhibits the 230k-to-430k issue, and which board I should build?

The problem is that the first patch posted here places .rel.dyn after ..bss, so when dumping u-boot.img, all of .bss is included in the file. Keeping it before .bss allows the flat binary to omit .bss as usual.

Indeed, but that accounts only for about 60k, as I said. Steve talks about a 200k delta; I can't find how this much can be added just by moving the .rel.dyn section around.

The idea of having .text, .*data and .bss contiguous is that it will reduce RAM footprint. In order to keep this and not increase FLASH/NAND footprint, I think we can overlap .bss and .rel.dyn.

Quoted 3 lines

Using the patch quoted above, I get a working u-boot from all combinations of gcc and binutils I cared to try, including gcc 4.5-linaro with binutils 2.20.1.

Thanks for the feedback.

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

Hello,

Am 02.11.2010 18:38, schrieb Albert ARIBAUD:

Quoted 12 lines
Quoted 3 lines

The problem is that the first patch posted here places .rel.dyn after ..bss, so when dumping u-boot.img, all of .bss is included in the file. Keeping it before .bss allows the flat binary to omit .bss as usual.

Indeed, but that accounts only for about 60k, as I said. Steve talks about a 200k delta; I can't find how this much can be added just by moving the .rel.dyn section around.

The idea of having .text, .*data and .bss contiguous is that it will reduce RAM footprint. In order to keep this and not increase FLASH/NAND footprint, I think we can overlap .bss and .rel.dyn.

Quoted 5 lines
Quoted 3 lines

Using the patch quoted above, I get a working u-boot from all combinations of gcc and binutils I cared to try, including gcc 4.5-linaro with binutils 2.20.1.

Thanks for the feedback.

Sorry, I never had an interest in the size of u-boot, therefore I haven't had a look at the size.

I've taken the time to compile u-boot with those gcc's I'm using here and with the patch which adds rel.* after and before bss:

after bss before

arm926ejs 4.3.4 661K            381K
arm926ejs 4.5.1 641K            360K
armv7 4.3.5     461K            262K
armv7 4.5.1     443K            244K (both don't work)

I've used always binutils 2.20.1.

The difference in sizes between arm926ejs (kirkwood ) and armv7 (omap3) are because of different options.

For the arm926ejs I'm using a non standard configuration, but for the armv7 I've used the standard config for the Beagleboard (make omap3_beagle_config) with the relocation-patch on top of commit 0c0892be0d93a5a892b93739c5eb3bf692fed4ff, so this one can be checked by others against other toolchains too.

Regards,

Alexander

PS: The problem with omap-u-boot and gcc 4.5.1 I'm having here is unrelated to relocation, I have this problem since I've installed gcc 4.5.1, means with older versions of u-boot too (without the new relocation).

#9 lore raw

PATCH 1/1 armv7: fix linker file for newer ld support

In reply to Steve Sakoman

Hello,

Am 02.11.2010 05:05, schrieb Steve Sakoman:

Quoted 4 lines

I've been using gcc 4.3.3, so I haven't run into the issue that this patch is attempting to fix.

just to correct this, the problem is a change in binutils and not, as I wrongly assumed earlier, gcc. Using ld from binutils 2.20.1 leads to problems with the relocation without a patch.

gcc is unrelated, at least here. I'm unable to get working u-boot for the Beagleboard using gcc 4.5.1 (and binutils 2.20.1), but using gcc 4.3.5 (and binutils 2.20.1) u-boot runs. There seems to be an error with using mmc, but I assume this is unrelated to relocation (as the problem with gcc 4.5.1).

Regards,

Alexander