Skip to contentSkip to conversation

ARMv7: Fix linker errors across toolchain versions

PATCH New Sanjeev Premi 4 participants 27 messages Dec 1, 2010 – Dec 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

This patch fixes the linker problems noticed while building the omap3_evm with Codesourcery toolchains 2009q1, 2009q3 and 2010q1.

The compilation was tested as success for both omap3_evm and omap3_beagle with toolchain versions 2009q1 and 2010q1.

[1] http://marc.info/?l=u-boot&m=129104332808386&w=2

---
The patch touches all ARMv7 architectures, will need to be reviewed thoroughly.

I am getting hang of relocation feature, but definitely hands-on. Impact would have to be reviewd as well. This is the reason for sending the patch early - before i start testing on the evm.

 arch/arm/cpu/armv7/u-boot.lds |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)
arch/arm/cpu/armv7/u-boot.lds +15 -11
index 5725c30..faf6ad8 100644
@@ -55,22 +55,26 @@ SECTIONS
 
 	. = ALIGN(4);
 
-	.rel.dyn : {
-		__rel_dyn_start = .;
-		*(.rel*)
-		__rel_dyn_end = .;
-	}
-
 	.dynsym : {
 		__dynsym_start = .;
 		*(.dynsym)
 	}
 
-	.bss __rel_dyn_start (OVERLAY) : {
-		__bss_start = .;
-		*(.bss)
-		 . = ALIGN(4);
-		_end = .;
+	OVERLAY : NOCROSSREFS
+	{
+		.rel.dyn {
+			__rel_dyn_start = .;
+			*(.rel*)
+			__rel_dyn_end = .;
+		}
+
+		.bss
+		{
+			__bss_start = .;
+			*(.bss)
+			 . = ALIGN(4);
+			_end = .;
+		}
 	}
 
 	/DISCARD/ : { *(.dynstr*) }
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 22 lines

-----Original Message-----
From: Premi, Sanjeev
Sent: Wednesday, December 01, 2010 8:47 PM
To: u-boot at lists.denx.de
Cc: Premi, Sanjeev
Subject: [PATCH] ARMv7: Fix linker errors across toolchain versions

This patch fixes the linker problems noticed while building the omap3_evm with Codesourcery toolchains 2009q1, 2009q3 and 2010q1.

The compilation was tested as success for both omap3_evm and omap3_beagle with toolchain versions 2009q1 and 2010q1.

[1] http://marc.info/?l=u-boot&m=129104332808386&w=2

---
The patch touches all ARMv7 architectures, will need to be reviewed thoroughly.

Quoted 8 lines

I am getting hang of relocation feature, but definitely hands-on. Impact would have to be reviewd as well. This is the reason for sending the patch early - before i start testing on the evm.

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

[snip]...[snip]

The u-boot built after this change alone gets stuck somewhere after dram_init(). However, removing the "sort" from LIBS (as suggested by Wolfgang), the u-boot comes up fine on the omap3_evm.

[patch]

Makefile +1 -1
index 87a383d..a530261 100644
@@ -263,7 +263,7 @@ ifeq ($(SOC),s5pc2xx)
 LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
 endif
 
-LIBS := $(addprefix $(obj),$(sort $(LIBS)))
+LIBS := $(addprefix $(obj),$(LIBS))
 .PHONY : $(LIBS) $(TIMESTAMP_FILE) $(VERSION_FILE)
 
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o

[/patch]

U-Boot 2010.12-rc2-00030-g4998cdc-dirty (Dec 01 2010 - 21:09:59)

OMAP3530-GP ES3.1, CPU-OPP2, L3-165MHz, Max CPU Clock 720 mHz OMAP3 EVM board + LPDDR/NAND

I2C:   ready
DRAM:  256 MiB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Read back SMSC id 0x92200000
Die ID #609200040000000004032d460c01201a
Net:   smc911x-0
Hit any key to stop autoboot:  0

OMAP3_EVM #
OMAP3_EVM #

Here is my git-log (including the patch above):
premi # g-log-10
4998cdc : ARMv7: Fix linker errors across toolchain versions 49733aa : Merge branch 'master' of /home/wd/git/u-boot/custodians f8264e0 : Merge branch 'master' of git://git.denx.de/u-boot-arm
b194577 : hwconfig: Fix dummy initialization of {board, cpu}_hwconfig a55bb83 : powerpc/85xx: Introduce CONFIG_SYS_EXTRA_ENV_RELOC 52eb2c7 : Merge branch 'master' of git://git.denx.de/u-boot-samsung
83b622a : Merge branch 'master' of /home/wd/git/u-boot/custodians 3410a99 : Merge branch 'master' of git://git.denx.de/u-boot-sh
a7bf3ec : Merge branch 'master' of /home/wd/git/u-boot/custodians e45c98a : mpc83xx: Make it boot again
premi #

#2 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Dear "Premi, Sanjeev",

Quoted 4 lines · In message <[email protected]> you…

The u-boot built after this change alone gets stuck somewhere after dram_init(). However, removing the "sort" from LIBS (as suggested by Wolfgang), the u-boot comes up fine on the omap3_evm.

I did NOT suggest that. This was just intended as debug hint. We do need this sort.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Human beings were created by water to transport it uphill.
#3 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

In reply to Sanjeev Premi

Le 01/12/2010 16:17, Sanjeev Premi a ?crit :

Quoted 55 lines

This patch fixes the linker problems noticed while building the omap3_evm with Codesourcery toolchains 2009q1, 2009q3 and 2010q1.

The compilation was tested as success for both omap3_evm and omap3_beagle with toolchain versions 2009q1 and 2010q1.

[1] http://marc.info/?l=u-boot&m=129104332808386&w=2

---
The patch touches all ARMv7 architectures, will need to be reviewed thoroughly.

I am getting hang of relocation feature, but definitely hands-on. Impact would have to be reviewd as well. This is the reason for sending the patch early - before i start testing on the evm.

  arch/arm/cpu/armv7/u-boot.lds |   26 +++++++++++++++-----------
  1 files changed, 15 insertions(+), 11 deletions(-)
arch/arm/cpu/armv7/u-boot.lds +8 -11
index 5725c30..faf6ad8 100644
@@ -55,22 +55,26 @@ SECTIONS
 
  	. = ALIGN(4);
 
-	.rel.dyn : {
-		__rel_dyn_start = .;
-		*(.rel*)
-		__rel_dyn_end = .;
-	}
-
  	.dynsym : {
  		__dynsym_start = .;
  		*(.dynsym)
  	}
 
-	.bss __rel_dyn_start (OVERLAY) : {
-		__bss_start = .;
-		*(.bss)
-		 . = ALIGN(4);
-		_end = .;
+	OVERLAY : NOCROSSREFS
+	{
+		.rel.dyn {
+			__rel_dyn_start = .;
+			*(.rel*)
+			__rel_dyn_end = .;
+		}
+

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

Quoted 10 lines
arch/arm/cpu/armv7/u-boot.lds +7 -0
+		.bss
+		{
+			__bss_start = .;
+			*(.bss)
+			 . = ALIGN(4);
+			_end = .;
+		}
  	}
 
  	/DISCARD/ : { *(.dynstr*) }

Nak -- what we want to overlay is .bss on one hand, and .rel.dyn *plus* .dynsym on the other hand; OVERLAY { ... } does not allow this.

Also, this change modifies the mapping, so if mi makes an obvious bug disappear, it may be only because the resulting u-boot corrupts relocation now in a less obvious way.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 74 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: Wednesday, December 01, 2010 10:43 PM
To: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 16:17, Sanjeev Premi a ?crit :

Quoted 20 lines

This patch fixes the linker problems noticed while building the omap3_evm with Codesourcery toolchains 2009q1, 2009q3 and 2010q1.

The compilation was tested as success for both omap3_evm and omap3_beagle with toolchain versions 2009q1 and 2010q1.

[1] http://marc.info/?l=u-boot&m=129104332808386&w=2

---
The patch touches all ARMv7 architectures, will need to be reviewed thoroughly.

I am getting hang of relocation feature, but definitely hands-on. Impact would have to be reviewd as well. This is the reason for sending the patch early - before i start testing on the evm.

Review

Quoted 4 lines
  arch/arm/cpu/armv7/u-boot.lds |   26 +++++++++++++++-----------
  1 files changed, 15 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

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

Quoted 40 lines

index 5725c30..faf6ad8 100644

arch/arm/cpu/armv7/u-boot.lds +15 -11
@@ -55,22 +55,26 @@ SECTIONS
 
  	. = ALIGN(4);
 
-	.rel.dyn : {
-		__rel_dyn_start = .;
-		*(.rel*)
-		__rel_dyn_end = .;
-	}
-
  	.dynsym : {
  		__dynsym_start = .;
  		*(.dynsym)
  	}
 
-	.bss __rel_dyn_start (OVERLAY) : {
-		__bss_start = .;
-		*(.bss)
-		 . = ALIGN(4);
-		_end = .;
+	OVERLAY : NOCROSSREFS
+	{
+		.rel.dyn {
+			__rel_dyn_start = .;
+			*(.rel*)
+			__rel_dyn_end = .;
+		}
+
+		.bss
+		{
+			__bss_start = .;
+			*(.bss)
+			 . = ALIGN(4);
+			_end = .;
+		}
  	}
 
Quoted 5 lines

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

Quoted 1 line
arch/arm/cpu/armv7/u-boot.lds +0 -0
  	/DISCARD/ : { *(.dynstr*) }

Nak -- what we want to overlay is .bss on one hand, and .rel.dyn *plus*
.dynsym on the other hand; OVERLAY { ... } does not allow this.

[sp] From the earlier discussion, I inferred the overlay was supposed
to be .rel.dyn and .bss.

Let me get the ".rel.dyn + .dynsym" overlay with ".bss".

If it works across compiler versions would that be okay?

~sanjeev

Quoted 13 lines

Also, this change modifies the mapping, so if mi makes an obvious bug disappear, it may be only because the resulting u-boot corrupts relocation now in a less obvious way.

Amicalement,

Signature · 5 lines
Albert.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
#5 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 18:19, Premi, Sanjeev a ?crit :

Quoted 6 lines
Quoted 3 lines

Nak -- what we want to overlay is .bss on one hand, and .rel.dyn *plus*
.dynsym on the other hand; OVERLAY { ... } does not allow this.

[sp] From the earlier discussion, I inferred the overlay was supposed
to be .rel.dyn and .bss.

That's because I avoid saying " .rel.dyn plus .dynsym" and just go for short ".rel.dyn" instead. Sorry for that.

Quoted 3 lines

Let me get the ".rel.dyn + .dynsym" overlay with ".bss".

If it works across compiler versions would that be okay?

Getting ".rel.dyn + .dynsym" overlay with ".bss" is exactly what the current linker file does, by emitting .rel.dyn, then .dynsym, then overlaying .bss back at the start of .rel.dyn. Look up a readelf -a of ./u-boot and see where each section starts and ends.

If you find another way to do this overlay yet end up producing a different binary, I'll be interested in the result, but I honestly don't think you will find any.

Quoted 1 line

~sanjeev

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 24 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Wednesday, December 01, 2010 11:02 PM
To: Premi, Sanjeev
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 18:19, Premi, Sanjeev a ?crit :

Quoted 5 lines
Quoted 3 lines

Nak -- what we want to overlay is .bss on one hand, and .rel.dyn *plus*
.dynsym on the other hand; OVERLAY { ... } does not allow this.

[sp] From the earlier discussion, I inferred the overlay

was supposed

Quoted 1 line

to be .rel.dyn and .bss.

That's because I avoid saying " .rel.dyn plus .dynsym" and just go for
short ".rel.dyn" instead. Sorry for that.

Quoted 1 line

Let me get the ".rel.dyn + .dynsym" overlay with ".bss".

Quoted 7 lines
Quoted 1 line

If it works across compiler versions would that be okay?

Getting ".rel.dyn + .dynsym" overlay with ".bss" is exactly what the current linker file does, by emitting .rel.dyn, then .dynsym, then overlaying .bss back at the start of .rel.dyn. Look up a readelf -a of
./u-boot and see where each section starts and ends.

[sp] I did the same - but focused only on .rel.dyn and .bss

Quoted 5 lines

If you find another way to do this overlay yet end up producing a different binary, I'll be interested in the result, but I honestly don't
think you will find any.

[sp] I am trying on this. Getting back to linker scripts after many
years. But assuming that there is no way; I am still looking for an explanation on:

1) why the current metod produces different errors across different toolchain versions.

2) How does presence of one variable alone breaks the build? At least, compiler doesn't complain. Even moving it out of .bss by explicit initialization doesn't help. BTW, I verified that it is not used anywhere till end of board_init_f() - didn't go further. Should I?

Can yo help me on these?

~sanjeev

Quoted 7 lines
Quoted 2 lines

~sanjeev

Amicalement,

Signature · 1 line
Albert.
#7 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 19:19, Premi, Sanjeev a ?crit :

Quoted 11 lines
Quoted 4 lines

If you find another way to do this overlay yet end up producing a different binary, I'll be interested in the result, but I honestly don't
think you will find any.

[sp] I am trying on this. Getting back to linker scripts after many
years. But assuming that there is no way; I am still looking for an explanation on:

1) why the current metod produces different errors across different toolchain versions.

Good question. I know this linker file is exactly the same as for arm926ejs, and I don't get the error with edminiv2 which is arm926ejs based; so it's not only different toolchains, it is also different boards or even different build environments.

Quoted 1 line

2) How does presence of one variable alone breaks the build?

Good question again.

Quoted 4 lines

At least, compiler doesn't complain. Even moving it out of .bss by explicit initialization doesn't help. BTW, I verified that it is not used anywhere till end of board_init_f() - didn't go further. Should I?

For the moment we should focus on what happens when we use the current .lds -- it causes a linker error, right? Once we get this sorted out, we'll see if the build actually runs.

Quoted 1 line

Can yo help me on these?

As for the linker error, I am sorry I got a bit lost: I know which toolchains you tried (2010q1 and 2009q1) but not exactly which codebase you build (is it v2010.12-rc2 ? master ? specific patches?) or which board you build. Please refresh me on this, so that I can reproduce the issue locally (I've got 2010q1 already installed).

Quoted 1 line

~sanjeev

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 8 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 12:07 AM
To: Premi, Sanjeev
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

[snip]...[snip]

Quoted 8 lines

For the moment we should focus on what happens when we use the current
.lds -- it causes a linker error, right? Once we get this sorted out, we'll see if the build actually runs.

Quoted 1 line

Can yo help me on these?

Quoted 7 lines

As for the linker error, I am sorry I got a bit lost: I know which toolchains you tried (2010q1 and 2009q1) but not exactly which codebase
you build (is it v2010.12-rc2 ? master ? specific patches?) or which board you build. Please refresh me on this, so that I can reproduce the
issue locally (I've got 2010q1 already installed).

I tried with 2009q1-203, 2009q3-68 and 2010q1-202.

But results with 2009q3 and 2010q1 were same - till I tried all three; so, currently using 2009q1 and 2010q1.

Yes. I was on latest master when I sent patch. Had included the git log as reference for same reason when I got it running.

Quoted 7 lines
Quoted 2 lines

~sanjeev

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

This one is a conundrum.

Using 2010q1, building omap3_evm causes a linker warning "arm-none-linux-gnueabi-ld: u-boot: section .bss vma 0x8003e8f0 overlaps previous sections" while building omap3_beagle does not cause any linker warning.

Both boards use the same armv7 u-boot.lds and have a .bss which is way bigger than the .rel.dyn plus .dynsym sections that it does overlay. IOW, they have a similar layout for .rel.dyn, .dynsym and .bss, but one gets the warning and one does not.

The one difference a readelf shows is that for beagle, there is only one segment:

00 .text .rodata .hash .data .got.plt .u_boot_cmd .rel.dyn .dynsym

While for evm there is

00 .text .rodata .hash .data .got.plt .u_boot_cmd .rel.dyn .bss 01 .dynsym

Note that .bss has appeared in segment 00 for evm, whereas it was absent for beagle, and that .dynsym was rejected to a second segment -- why? I don't know.

Note: I've tried with putting input sections .rel.dyn and .dynsym into a single output section .rel.dyn: this makes the second segment disappear, but for evm the warning remains and .bss remains in the segment.

Amicalement,

Signature · 1 line
Albert.
#10 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 22:39, Albert ARIBAUD a ?crit :

Quoted 22 lines

This one is a conundrum.

Using 2010q1, building omap3_evm causes a linker warning "arm-none-linux-gnueabi-ld: u-boot: section .bss vma 0x8003e8f0 overlaps previous sections" while building omap3_beagle does not cause any linker warning.

Both boards use the same armv7 u-boot.lds and have a .bss which is way bigger than the .rel.dyn plus .dynsym sections that it does overlay. IOW, they have a similar layout for .rel.dyn, .dynsym and .bss, but one gets the warning and one does not.

The one difference a readelf shows is that for beagle, there is only one segment:

00 .text .rodata .hash .data .got.plt .u_boot_cmd .rel.dyn .dynsym

While for evm there is

00 .text .rodata .hash .data .got.plt .u_boot_cmd .rel.dyn .bss 01 .dynsym

Quoted 7 lines

Note that .bss has appeared in segment 00 for evm, whereas it was absent for beagle, and that .dynsym was rejected to a second segment -- why? I don't know.

Note: I've tried with putting input sections .rel.dyn and .dynsym into a single output section .rel.dyn: this makes the second segment disappear, but for evm the warning remains and .bss remains in the segment.

I have a tiny clue.

Starting with the fact that the linker issue is only for one board, omap3_evm, I looked up the board-specific code. First thing that I noticed was

	static u8 omap3_evm_version;

I changed this to

	static u8 omap3_evm_version = 1;

so that the static was moved out of BSS and the linker warning disappeared (reminder: v2010.12-rc2, omap3_evm, arm-2010q1).

Now this is not the first static BSS variable we use in U-Boot, and the others did not cause linker warnings (not *all* the others, at least), so the real cause is yet unknown to me. But that's at least a lead we can follow.

If this BSS variable is used before relocation (I haven't checked this), then anyway it'll have to move; in that case I'll keep an eye on this linker warning and try to sort it out if I get time.

Amicalement,

Signature · 1 line
Albert.
#11 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Dear Albert ARIBAUD,

Quoted 11 lines · In message <[email protected]> you wrote:

Starting with the fact that the linker issue is only for one board, omap3_evm, I looked up the board-specific code. First thing that I noticed was

	static u8 omap3_evm_version;

I changed this to

	static u8 omap3_evm_version = 1;
Quoted 7 lines

so that the static was moved out of BSS and the linker warning disappeared (reminder: v2010.12-rc2, omap3_evm, arm-2010q1).

Now this is not the first static BSS variable we use in U-Boot, and the others did not cause linker warnings (not *all* the others, at least), so the real cause is yet unknown to me. But that's at least a lead we can follow.

Write access is only in omap3_evm_get_revision() which in turn only gets called in misc_init_r(), i. e. after relocation.

Read access is only in get_omap3_evm_rev() [which is not called outside this file and thus should be made static!] which gets called only in omap3_evm_need_extvbus() which gets acalled only in musb_platform_init(), i. e. during USB init.

This should be safe.

You could try out what happens if you make get_omap3_evm_rev() static...

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Without followers, evil cannot spread.
	-- Spock, "And The Children Shall Lead", stardate 5029.5
#12 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Hi Wolfgang,

Le 02/12/2010 08:34, Wolfgang Denk a ?crit :

Quoted 25 lines

Dear Albert ARIBAUD,

Quoted 11 lines · In message<[email protected]> you wrote:

Starting with the fact that the linker issue is only for one board, omap3_evm, I looked up the board-specific code. First thing that I noticed was

	static u8 omap3_evm_version;

I changed this to

	static u8 omap3_evm_version = 1;
Quoted 7 lines

so that the static was moved out of BSS and the linker warning disappeared (reminder: v2010.12-rc2, omap3_evm, arm-2010q1).

Now this is not the first static BSS variable we use in U-Boot, and the others did not cause linker warnings (not *all* the others, at least), so the real cause is yet unknown to me. But that's at least a lead we can follow.

Write access is only in omap3_evm_get_revision() which in turn only gets called in misc_init_r(), i. e. after relocation.

Quoted 6 lines

Read access is only in get_omap3_evm_rev() [which is not called outside this file and thus should be made static!] which gets called only in omap3_evm_need_extvbus() which gets acalled only in musb_platform_init(), i. e. during USB init.

This should be safe.

Alright.

Quoted 1 line

You could try out what happens if you make get_omap3_evm_rev() static...

No change: the warning remains, and so do the two segments.

Maybe I should subscribe the binutils list and ask there.

Meanwhile, this variable could be initialized to some safe value such as OMAP3EVM_BOARD_UNKNOWN.

BTW... Why on Earth is it an uint8? Probably a space saving measure, but one I think is not really fruitful, because of probable paddings and alignments; making it an int would allow using smsc_id directly as values for the OMAP3EVM_BOARD_GEN_1 and OMAP3EVM_BOARD_GEN_2...

... plus it removes the linker warning!

I thus suggest turning omap3_evm_version from uint8 to int and get on with debugging the board.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#13 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Dear Albert ARIBAUD,

Quoted 7 lines · In message <[email protected]> you wrote:

BTW... Why on Earth is it an uint8? Probably a space saving measure, but one I think is not really fruitful, because of probable paddings and alignments; making it an int would allow using smsc_id directly as values for the OMAP3EVM_BOARD_GEN_1 and OMAP3EVM_BOARD_GEN_2...

... plus it removes the linker warning!

Oops. Why would this make a difference?

Quoted 2 lines

I thus suggest turning omap3_evm_version from uint8 to int and get on with debugging the board.

No, I don't think this is a good idea as it just papers over an existing problem.

Does it help when you change the "*(.bss)" in
"arch/arm/cpu/armv7/u-boot.lds" into "*(.*bss)"
(so it also includes any .sbss objects) ?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
ATTENTION: Despite Any Other Listing of Product Contents Found  Here-
on, the Consumer is Advised That, in Actuality, This Product Consists
Of 99.9999999999% Empty Space.
#14 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Le 02/12/2010 09:13, Wolfgang Denk a ?crit :

Quoted 4 lines

Dear Albert ARIBAUD,

Quoted 1 line · In message<[email protected]> you wrote:
Quoted 8 lines
Quoted 6 lines

BTW... Why on Earth is it an uint8? Probably a space saving measure, but one I think is not really fruitful, because of probable paddings and alignments; making it an int would allow using smsc_id directly as values for the OMAP3EVM_BOARD_GEN_1 and OMAP3EVM_BOARD_GEN_2...

... plus it removes the linker warning!

Oops. Why would this make a difference?

Alignement issues, possibly, although we do align the location pointer before the overlay point -- or some bug in the linker.

Quoted 5 lines
Quoted 2 lines

I thus suggest turning omap3_evm_version from uint8 to int and get on with debugging the board.

No, I don't think this is a good idea as it just papers over an existing problem.

Oh--I did not mean to forget the linker warning thing. Just separate the issues, because I think this particular linker warning is unrelated with getting the board working.

So Sanjeev would change the u8 to an int and proceed with board debug, and I would investigate this issue -- actually, try and find a minimal example that I could go to the binutils list with rather than a full-blown u-boot tree.

Quoted 3 lines

Does it help when you change the "*(.bss)" in
"arch/arm/cpu/armv7/u-boot.lds" into "*(.*bss)"
(so it also includes any .sbss objects) ?

No change.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#15 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 7 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 1:57 PM
To: Wolfgang Denk
Cc: u-boot at lists.denx.de; Premi, Sanjeev
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

[snip]

Quoted 3 lines

So Sanjeev would change the u8 to an int and proceed with board debug,

I will be away from desk for an hour. Will have the patch posted immediately after...

~sanjeev

#16 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Hi Sanjeev,

Le 02/12/2010 09:30, Premi, Sanjeev a ?crit :

Quoted 8 lines
Quoted 7 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 1:57 PM
To: Wolfgang Denk
Cc: u-boot at lists.denx.de; Premi, Sanjeev
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Quoted 8 lines

[snip]

Quoted 3 lines

So Sanjeev would change the u8 to an int and proceed with board debug,

I will be away from desk for an hour. Will have the patch posted immediately after...

Please let us know the current status of the board, i.e. whether it works or not, and if not, what the console output is.

Amicalement,

Signature · 1 line
Albert.
#17 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 22 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 2:12 PM
To: Premi, Sanjeev
Cc: Wolfgang Denk; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Hi Sanjeev,

Le 02/12/2010 09:30, Premi, Sanjeev a ?crit :

Quoted 11 lines
Quoted 7 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 1:57 PM
To: Wolfgang Denk
Cc: u-boot at lists.denx.de; Premi, Sanjeev
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

[snip]

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So Sanjeev would change the u8 to an int and proceed with board debug,

I will be away from desk for an hour. Will have the patch posted immediately after...

Please let us know the current status of the board, i.e. whether it works or not, and if not, what the console output is.

Just posted the patch. The u-boot comes up on the EVM - only after sort related change in the Makefile. Haven't debuged it yet.

Also noticed a difference between the changes I made yesterday; and your mail - maintaining 'u8' vs. 'int' for the omap3_evm_revision.

~sanjeev

Quoted 5 lines

Amicalement,

Signature · 1 line
Albert.
#18 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Dear "Premi, Sanjeev",

Quoted 3 lines · In message <[email protected]> you…

Just posted the patch. The u-boot comes up on the EVM - only after sort related change in the Makefile. Haven't debuged it yet.

Could you ***please*** be a bit more precise?

What EXACTLY was that "sort related change"?

Do you still need to remove the $(sort) call for the LIBS? That should NOT be done.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can't evaluate a man by logic alone.
	-- McCoy, "I, Mudd", stardate 4513.3
#19 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Quoted 17 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Thursday, December 02, 2010 5:09 PM
To: Premi, Sanjeev
Cc: Albert ARIBAUD; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Dear "Premi, Sanjeev",

In message <[email protected]>

Quoted 3 lines · you

Just posted the patch. The u-boot comes up on the EVM - only after sort related change in the Makefile. Haven't debuged it yet.

Quoted 6 lines

Could you ***please*** be a bit more precise?

What EXACTLY was that "sort related change"?

Do you still need to remove the $(sort) call for the LIBS? That should NOT be done.

Wolfgang,

I know it shouldn't be done - but just trying to take problem one by one. Unless you want me to report the problems onl after I have a fix for them - and not seek any help.

~sanjeev

Quoted 13 lines

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can't evaluate a man by logic alone.
	-- McCoy, "I, Mudd", stardate 4513.3
#20 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Dear "Premi, Sanjeev",

Quoted 3 lines · In message <[email protected]> you…
Quoted 3 lines

Do you still need to remove the $(sort) call for the LIBS? That should NOT be done.

...

Quoted 3 lines

I know it shouldn't be done - but just trying to take problem one by one. Unless you want me to report the problems onl after I have a fix for them - and not seek any help.

Well, the thing is that I am not convinced that these are really two separate issues. Both seem to have somethign to do with what the linker is doing.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No question is too silly to ask. Of course, some  questions  are  too
silly to to answer...  - L. Wall & R. L. Schwartz, _Programming Perl_
#21 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

In reply to Albert ARIBAUD

Dear Albert ARIBAUD,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 4 lines

Does it help when you change the "*(.bss)" in
"arch/arm/cpu/armv7/u-boot.lds" into "*(.*bss)"
(so it also includes any .sbss objects) ?

No change.

Hm... Maybe it is indeed not a good idea to mix short objects with those requiring larger alignments - we might lose space at best, or case misaligned variables? Eventually it's better to explicitly write

	*(.bss*)
	*(.sbss*)

as we have it in many PowerPC linker scripts (but I have to admit that I don't know if this is really needed - I don't see any .sbss anywhere in this build (I do see them in some objects for PowerPC). For example:

PowerPC:

-> readelf -S common/dlmalloc.o | grep bss

  [ 3] .bss              NOBITS          00000000 000034 000000 00  WA  0   0  1
  [36] .bss.n_mmaps_max  NOBITS          00000000 002728 000004 00  WA  0   0  4
  [37] .sbss.mem_malloc_ NOBITS          00000000 002728 000004 00  WA  0   0  4
  [38] .bss.max_total_me NOBITS          00000000 002728 000004 00  WA  0   0  4
  [40] .bss.max_sbrked_m NOBITS          00000000 00272c 000004 00  WA  0   0  4
  [43] .bss.top_pad      NOBITS          00000000 002734 000004 00  WA  0   0  4
  [44] .sbss.mem_malloc_ NOBITS          00000000 002734 000004 00  WA  0   0  4
  [45] .sbss.mem_malloc_ NOBITS          00000000 002734 000004 00  WA  0   0  4
  [46] .bss.current_mall NOBITS          00000000 002734 000028 00  WA  0   0  4

ARM:

-> readelf -S common/dlmalloc.o | grep bss
[ 5] .bss NOBITS 00000000 0015e0 000044 00 WA 0 0 4

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I've got a bad feeling about this.
#22 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

In reply to Albert ARIBAUD
Quoted 51 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 1:21 PM
To: Wolfgang Denk
Cc: u-boot at lists.denx.de; Premi, Sanjeev
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Hi Wolfgang,

Le 02/12/2010 08:34, Wolfgang Denk a ?crit :

Quoted 18 lines

Dear Albert ARIBAUD,

Quoted 15 lines · In message<[email protected]> you wrote:

Starting with the fact that the linker issue is only for one board, omap3_evm, I looked up the board-specific code. First thing that I noticed was

	static u8 omap3_evm_version;

I changed this to

	static u8 omap3_evm_version = 1;

so that the static was moved out of BSS and the linker warning disappeared (reminder: v2010.12-rc2, omap3_evm, arm-2010q1).

Now this is not the first static BSS variable we use in

U-Boot, and the

Quoted 1 line
Quoted 1 line

others did not cause linker warnings (not *all* the

others, at least),

Quoted 1 line
Quoted 1 line

so the real cause is yet unknown to me. But that's at

least a lead we

Quoted 11 lines
Quoted 1 line

can follow.

Write access is only in omap3_evm_get_revision() which in turn only gets called in misc_init_r(), i. e. after relocation.

Read access is only in get_omap3_evm_rev() [which is not called outside this file and thus should be made static!] which gets called only in omap3_evm_need_extvbus() which gets acalled only in musb_platform_init(), i. e. during USB init.

This should be safe.

Alright.

Quoted 1 line

You could try out what happens if you make

get_omap3_evm_rev() static...

Quoted 7 lines

No change: the warning remains, and so do the two segments.

Maybe I should subscribe the binutils list and ask there.

Meanwhile, this variable could be initialized to some safe value such as
OMAP3EVM_BOARD_UNKNOWN.

One of the things I did to move it away from .bss

Quoted 11 lines

BTW... Why on Earth is it an uint8? Probably a space saving measure, but
one I think is not really fruitful, because of probable paddings and alignments; making it an int would allow using smsc_id directly as values for the OMAP3EVM_BOARD_GEN_1 and OMAP3EVM_BOARD_GEN_2...

... plus it removes the linker warning!

I thus suggest turning omap3_evm_version from uint8 to int and get on with debugging the board.

Albert,

I have already done this - may not be exactly same. while trying to debug linker script problem; did not want to deviate from the current problem so it is in my working code.

~sanjeev

Quoted 9 lines
Quoted 4 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#23 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

In reply to Albert ARIBAUD
Quoted 70 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, December 02, 2010 12:30 PM
To: u-boot at lists.denx.de
Cc: Premi, Sanjeev; Wolfgang Denk
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 22:39, Albert ARIBAUD a ?crit :

Quoted 4 lines

This one is a conundrum.

Using 2010q1, building omap3_evm causes a linker warning "arm-none-linux-gnueabi-ld: u-boot: section .bss vma

0x8003e8f0 overlaps

Quoted 1 line

previous sections" while building omap3_beagle does not

cause any linker

Quoted 3 lines

warning.

Both boards use the same armv7 u-boot.lds and have a .bss

which is way

Quoted 2 lines

bigger than the .rel.dyn plus .dynsym sections that it does overlay. IOW, they have a similar layout for .rel.dyn, .dynsym and

.bss, but one

Quoted 3 lines

gets the warning and one does not.

The one difference a readelf shows is that for beagle,

there is only one

Quoted 10 lines

segment:

00 .text .rodata .hash .data .got.plt .u_boot_cmd .rel.dyn .dynsym

While for evm there is

00 .text .rodata .hash .data .got.plt .u_boot_cmd .rel.dyn .bss 01 .dynsym

Note that .bss has appeared in segment 00 for evm, whereas

it was absent

Quoted 1 line

for beagle, and that .dynsym was rejected to a second

segment -- why? I

Quoted 3 lines

don't know.

Note: I've tried with putting input sections .rel.dyn and

.dynsym into a

Quoted 1 line

single output section .rel.dyn: this makes the second

segment disappear,

Quoted 1 line

but for evm the warning remains and .bss remains in the segment.

I have a tiny clue.

Starting with the fact that the linker issue is only for one board, omap3_evm, I looked up the board-specific code. First thing that I noticed was

	static u8 omap3_evm_version;

I changed this to

	static u8 omap3_evm_version = 1;

so that the static was moved out of BSS and the linker warning disappeared (reminder: v2010.12-rc2, omap3_evm, arm-2010q1).

Now this is not the first static BSS variable we use in U-Boot, and the
others did not cause linker warnings (not *all* the others, at least),
so the real cause is yet unknown to me. But that's at least a lead we can follow.

Quoted 4 lines

If this BSS variable is used before relocation (I haven't checked this),
then anyway it'll have to move; in that case I'll keep an eye on this linker warning and try to sort it out if I get time.

I did explain yesterday that variable is not used in relocation. If you notice the code snippet I sent yesterday, I had removed every assignment to the variable. And 2009q1 was still not happy!

Quoted 5 lines

Amicalement,

Signature · 1 line
Albert.
#24 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

In reply to Premi

Dear "Premi, Sanjeev",

Quoted 3 lines · In message <[email protected]> you…

1) why the current metod produces different errors across different toolchain versions.

Different tool chains may prvide different quality of optimizations (and bugs), resulting in differnt variable locations. With one memory map you notice immediately if a value gets overwritten, with another you may not notice it.

Quoted 1 line

2) How does presence of one variable alone breaks the build?

It changes the memory map, and thus the location which may get overwritten.

Quoted 1 line

At least, compiler doesn't complain. Even moving it out

How should it? From the tool chain's point of view everything is fine. It's the programmer who did things that lead to trouble; we only get what we deserve.

Quoted 1 line

of .bss by explicit initialization doesn't help.

How exactly did you initialize the variable? Like "int foo = 0;"? Note that this will still go to BSS.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Harrison's Postulate:
	For every action, there is an equal and opposite criticism.
#25 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

In reply to Albert ARIBAUD
Quoted 32 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Wednesday, December 01, 2010 11:02 PM
To: Premi, Sanjeev
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 18:19, Premi, Sanjeev a ?crit :

Quoted 5 lines
Quoted 3 lines

Nak -- what we want to overlay is .bss on one hand, and .rel.dyn *plus*
.dynsym on the other hand; OVERLAY { ... } does not allow this.

[sp] From the earlier discussion, I inferred the overlay

was supposed

Quoted 1 line

to be .rel.dyn and .bss.

That's because I avoid saying " .rel.dyn plus .dynsym" and just go for
short ".rel.dyn" instead. Sorry for that.

Quoted 3 lines

Let me get the ".rel.dyn + .dynsym" overlay with ".bss".

If it works across compiler versions would that be okay?

Getting ".rel.dyn + .dynsym" overlay with ".bss" is exactly what the current linker file does, by emitting .rel.dyn, then .dynsym, then overlaying .bss back at the start of .rel.dyn. Look up a readelf -a of
./u-boot and see where each section starts and ends.

Quoted 4 lines

If you find another way to do this overlay yet end up producing a different binary, I'll be interested in the result, but I honestly don't
think you will find any.

[sp] Had a quick question - hence separate mail.

Do we really need to preserve section ".dynsym" in the final binary. OR are we okay with single section that contains contents from both?

~sanjeev

Quoted 7 lines
Quoted 2 lines

~sanjeev

Amicalement,

Signature · 1 line
Albert.
#26 lore raw

PATCH 1/1 ARMv7: Fix linker errors across toolchain versions

Le 01/12/2010 19:23, Premi, Sanjeev a ?crit :

Quoted 5 lines

[sp] Had a quick question - hence separate mail.

Do we really need to preserve section ".dynsym" in the final binary. OR are we okay with single section that contains contents from both?

A single section should be OK.

Amicalement,

Signature · 1 line
Albert.