Skip to contentSkip to conversation

2.6.26-rc1 on x86: ld: warning: dot moved backwards before `.text'

DISCUSSION Mikael Pettersson 6 participants 16 messages May 10, 2008 – May 12, 2008

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

Building kernel 2.6.26-rc1 on FC6/i386 causes:

ld -m elf_i386 -T arch/x86/kernel/acpi/realmode/wakeup.lds arch/x86/kernel/acpi/realmode/wakeup.o arch/x86/kernel/acpi/realmode/wakemain.o arch/x86/kernel/acpi/realmode/video-mode.o arch/x86/kernel/acpi/realmode/copy.o arch/x86/kernel/acpi/realmode/video-vga.o arch/x86/kernel/acpi/realmode/video-vesa.o arch/x86/kernel/acpi/realmode/video-bios.o -o arch/x86/kernel/acpi/realmode/wakeup.elf
ld: warning: dot moved backwards before `.text'
ld: warning: dot moved backwards before `.text'
ld: warning: dot moved backwards before `.text'

This is with gcc-4.2.3 and binutils-2.17.50.0.6-5.fc6 20061020.

The resulting kernel hasn't broken on me yet, however.

A search through the LKML archives showed that this was reported for 2.6.25-rc3-mm1, but I couldn't find any discussion about it after that:

<http://marc.info/?l=linux-kernel&m=120470303728010&w=2>

The .config causing this warning is available in
<http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>

/Mikael

#1 lore raw
Quoted 10 lines · Mikael Pettersson

Building kernel 2.6.26-rc1 on FC6/i386 causes:

ld -m elf_i386 -T arch/x86/kernel/acpi/realmode/wakeup.lds arch/x86/kernel/acpi/realmode/wakeup.o arch/x86/kernel/acpi/realmode/wakemain.o arch/x86/kernel/acpi/realmode/video-mode.o arch/x86/kernel/acpi/realmode/copy.o arch/x86/kernel/acpi/realmode/video-vga.o arch/x86/kernel/acpi/realmode/video-vesa.o arch/x86/kernel/acpi/realmode/video-bios.o -o arch/x86/kernel/acpi/realmode/wakeup.elf
ld: warning: dot moved backwards before `.text'
ld: warning: dot moved backwards before `.text'
ld: warning: dot moved backwards before `.text'

This is with gcc-4.2.3 and binutils-2.17.50.0.6-5.fc6 20061020.

The resulting kernel hasn't broken on me yet, however.

It shouldn't. Have you tried to suspend to RAM?

Quoted 8 lines

A search through the LKML archives showed that this was reported for 2.6.25-rc3-mm1, but I couldn't find any discussion about it after that:

<http://marc.info/?l=linux-kernel&m=120470303728010&w=2>

The .config causing this warning is available in
<http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>

Well, we don't really know why this happens. It surely doesn't happen with newer toolchains (as of OpenSUSE 10.3 for example).

Thanks,
Rafael

#2 lore raw
In reply to Mikael Pettersson
Quoted 12 lines · Mikael Pettersson

The resulting kernel hasn't broken on me yet, however.

A search through the LKML archives showed that this was reported for 2.6.25-rc3-mm1, but I couldn't find any discussion about it after that:

<http://marc.info/?l=linux-kernel&m=120470303728010&w=2>

The .config causing this warning is available in
<http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>

This is because the organization of the file was changed, and the linker script wasn't changed to match:

SECTIONS

{
        . = HEADER_OFFSET;
        .header : {
                 *(.header)
        }

        . = 0;
        .text : {
                 *(.text*)
        }

This is crap; the sections should be listed *in order* so the linker can warn properly when something bad happens.

The code should be correct; reorganizing the linker script correctly should fix the problem.

-hpa

#3 lore raw
Quoted 29 lines · H. Peter Anvin
Quoted 12 lines · Mikael Pettersson

The resulting kernel hasn't broken on me yet, however.

A search through the LKML archives showed that this was reported for 2.6.25-rc3-mm1, but I couldn't find any discussion about it after that:

<http://marc.info/?l=linux-kernel&m=120470303728010&w=2>

The .config causing this warning is available in
<http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>

This is because the organization of the file was changed, and the linker script wasn't changed to match:

SECTIONS

{
         . = HEADER_OFFSET;
         .header : {
                  *(.header)
         }

         . = 0;
         .text : {
                  *(.text*)
         }
Quoted 5 lines

This is crap; the sections should be listed *in order* so the linker can warn properly when something bad happens.

The code should be correct; reorganizing the linker script correctly should fix the problem.

Hm. The above is from Pavel and Sam.

Thanks,
Rafael

#4 lore raw

Hi!

Quoted 27 lines
Quoted 27 lines
Quoted 11 lines

The resulting kernel hasn't broken on me yet, however.

A search through the LKML archives showed that this was reported for 2.6.25-rc3-mm1, but I couldn't find any discussion about it after that:

<http://marc.info/?l=linux-kernel&m=120470303728010&w=2>

The .config causing this warning is available in
<http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>

This is because the organization of the file was changed, and the linker script wasn't changed to match:

SECTIONS

{
         . = HEADER_OFFSET;
         .header : {
                  *(.header)
         }

         . = 0;
         .text : {
                  *(.text*)
         }
Quoted 5 lines
Quoted 5 lines

This is crap; the sections should be listed *in order* so the linker can warn properly when something bad happens.

The code should be correct; reorganizing the linker script correctly should fix the problem.

I'm not good at linker magic. I needed to put code from offset zero, while still having header at known address...

Quoted 1 line

Hm. The above is from Pavel and Sam.

Sorry about that. Plus, I'm on holidays just now...

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw
In reply to H. Peter Anvin
Quoted 29 lines · H. Peter Anvin
Quoted 12 lines · Mikael Pettersson

The resulting kernel hasn't broken on me yet, however.

A search through the LKML archives showed that this was reported for 2.6.25-rc3-mm1, but I couldn't find any discussion about it after that:

<http://marc.info/?l=linux-kernel&m=120470303728010&w=2>

The .config causing this warning is available in
<http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>

This is because the organization of the file was changed, and the linker script wasn't changed to match:

SECTIONS

{
        . = HEADER_OFFSET;
        .header : {
                 *(.header)
        }

        . = 0;
        .text : {
                 *(.text*)
        }
Quoted 5 lines

This is crap; the sections should be listed *in order* so the linker can warn properly when something bad happens.

The code should be correct; reorganizing the linker script correctly should fix the problem.

I need Pavel to comment on this.
Why we start with . equal 0x3f00 and then later as . equals 0x0000 I dunno.
I did not look into this part of the code back then - but I should anyway have seen this flaw in the linker script :-(

Sam

#6 lore raw

[Sam Ravnborg - Sat, May 10, 2008 at 11:16:02PM +0200]

| On Sat, May 10, 2008 at 01:25:53PM -0700, H. Peter Anvin wrote:
| > Mikael Pettersson wrote:
| > >
| > >The resulting kernel hasn't broken on me yet, however.
| > >
| > >A search through the LKML archives showed that this was reported
| > >for 2.6.25-rc3-mm1, but I couldn't find any discussion about it
| > >after that:
| > >
| > ><http://marc.info/?l=linux-kernel&m=120470303728010&w=2>
| > >
| > >The .config causing this warning is available in
| > ><http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>
| > >
| > 
| > This is because the organization of the file was changed, and the linker 
| > script wasn't changed to match:
| > 
| > SECTIONS
| > {
| >         . = HEADER_OFFSET;
| >         .header : {
| >                  *(.header)
| >         }
| > 
| >         . = 0;
| >         .text : {
| >                  *(.text*)
| >         }
| > 
| > This is crap; the sections should be listed *in order* so the linker can 
| > warn properly when something bad happens.
| > 
| > The code should be correct; reorganizing the linker script correctly 
| > should fix the problem.
| 
| I need Pavel to comment on this.
| Why we start with . equal 0x3f00 and then later as . equals 0x0000
| I dunno.
| I did not look into this part of the code back then - but I should anyway
| have seen this flaw in the linker script :-(
| 
| 	Sam

Should not it be something like
---

arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -5
index 22fab6c..cccf62d 100644
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = HEADER_OFFSET;
-	.header : {
-		 *(.header)
-	}
-
 	. = 0;
 	.text : {
 		 *(.text*)
@@ -53,6 +48,11 @@ SECTIONS
 	. = ALIGN(16);
 	_end = .;
 
+	. = HEADER_OFFSET;
+	.header : {
+		 *(.header)
+	}
+
 	/DISCARD/ : {
 		*(.note*)
 	}

---
- Cyrill -

#7 lore raw
Quoted 33 lines · Cyrill Gorcunov

Should not it be something like
---

arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -6
index 22fab6c..cccf62d 100644
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = HEADER_OFFSET;
-	.header : {
-		 *(.header)
-	}
-
 	. = 0;
 	.text : {
 		 *(.text*)
@@ -53,6 +48,11 @@ SECTIONS
 	. = ALIGN(16);
 	_end = .;
 
+	. = HEADER_OFFSET;
+	.header : {
+		 *(.header)
+	}
+
 	/DISCARD/ : {
 		*(.note*)
 	}
---
Quoted 1 line

- Cyrill -

Yes. This was the way I originally had it, then Pavel decided to move the header to the end.

-hpa

#8 lore raw

[H. Peter Anvin - Sun, May 11, 2008 at 11:15:04AM -0700]

Quoted 36 lines
Quoted 30 lines · Cyrill Gorcunov

Should not it be something like
---

arch/x86/kernel/acpi/realmode/wakeup.lds.S +4 -6
index 22fab6c..cccf62d 100644
@@ -12,11 +12,6 @@ ENTRY(_start)
  SECTIONS
 {
-	. = HEADER_OFFSET;
-	.header : {
-		 *(.header)
-	}
-
 	. = 0;
 	.text : {
 		 *(.text*)
@@ -53,6 +48,11 @@ SECTIONS
 	. = ALIGN(16);
 	_end = .;
 +	. = HEADER_OFFSET;
+	.header : {
+		 *(.header)
+	}
+
 	/DISCARD/ : {
 		*(.note*)
 	}
---
Quoted 1 line

- Cyrill -

Yes. This was the way I originally had it, then Pavel decided to move the header to the end.

Quoted 2 lines

-hpa

Hi Peter,

actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):

wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin"
wakeup_code_end:

and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

	. = HEADER_OFFSET;
	.header : {
		...
	}
	. = ALIGN(16);
	_end = .;
	/DISCARD/ ...

		- Cyrill -
#9 lore raw
Quoted 14 lines · Cyrill Gorcunov

Hi Peter,

actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):

wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin"
wakeup_code_end:

and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

Quoted 8 lines
	. = HEADER_OFFSET;
	.header : {
		...
	}
	. = ALIGN(16);
	_end = .;
	/DISCARD/ ...

Yes, I believe that's correct.

-hpa

#10 lore raw

[H. Peter Anvin - Sun, May 11, 2008 at 11:25:54AM -0700]

Quoted 18 lines
Quoted 9 lines · Cyrill Gorcunov

Hi Peter,
actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):
wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin"
wakeup_code_end:
and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

Quoted 7 lines
	. = HEADER_OFFSET;
	.header : {
		...
	}
	. = ALIGN(16);
	_end = .;
	/DISCARD/ ...
Quoted 4 lines

Yes, I believe that's correct.

-hpa

Thanks for review, Peter, I'll cook a patch and wait for Pavel's opinion ;-)

- Cyrill -

#11 lore raw
Quoted 19 lines · Cyrill Gorcunov

[H. Peter Anvin - Sun, May 11, 2008 at 11:25:54AM -0700]

Quoted 18 lines
Quoted 16 lines · Cyrill Gorcunov

Hi Peter,
actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):
wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin"
wakeup_code_end:
and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

	. = HEADER_OFFSET;
	.header : {
		...
	}
	. = ALIGN(16);
	_end = .;
	/DISCARD/ ...
Quoted 7 lines
Quoted 4 lines

Yes, I believe that's correct.

-hpa

Thanks for review, Peter, I'll cook a patch and wait for Pavel's opinion ;-)

I've tested the appended one. If that's what you mean, we'll ask Ingo to take it.

Thanks,
Rafael

---
 arch/x86/kernel/acpi/realmode/wakeup.lds.S |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -5
Index: linux-2.6/arch/x86/kernel/acpi/realmode/wakeup.lds.S
===================================================================
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = HEADER_OFFSET;
-	.header : {
-		 *(.header)
-	}
-
 	. = 0;
 	.text : {
 		 *(.text*)
@@ -50,6 +45,11 @@ SECTIONS
 		__bss_end = .;
 	}
 
+	. = HEADER_OFFSET;
+	.header : {
+		 *(.header)
+	}
+
 	. = ALIGN(16);
 	_end = .;
 
#12 lore raw
Quoted 58 lines · Rafael J. Wysocki
Quoted 19 lines · Cyrill Gorcunov

[H. Peter Anvin - Sun, May 11, 2008 at 11:25:54AM -0700]

Quoted 18 lines
Quoted 16 lines · Cyrill Gorcunov

Hi Peter,
actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):
wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin" wakeup_code_end:
and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

   . = HEADER_OFFSET;
   .header : {
           ...
   }
   . = ALIGN(16);
   _end = .;
   /DISCARD/ ...
Quoted 7 lines
Quoted 4 lines

Yes, I believe that's correct.

-hpa

Thanks for review, Peter, I'll cook a patch and wait for Pavel's opinion ;-)

I've tested the appended one. If that's what you mean, we'll ask Ingo to take it.

Thanks,
Rafael

---
 arch/x86/kernel/acpi/realmode/wakeup.lds.S |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6/arch/x86/kernel/acpi/realmode/wakeup.lds.S
===================================================================

arch/x86/kernel/acpi/realmode/wakeup.lds.S +0 -5
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-       . = HEADER_OFFSET;
-       .header : {
-                *(.header)
-       }
-
       . = 0;
       .text : {
                *(.text*)
@@ -50,6 +45,11 @@ SECTIONS
               __bss_end = .;

arch/x86/kernel/acpi/realmode/wakeup.lds.S SECTIONS · line 55

Quoted 10 lines
arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -0
       }
 
+       . = HEADER_OFFSET;
+       .header : {
+                *(.header)
+       }
+
       . = ALIGN(16);
       _end = .;
 

Thanks Rafael,

it's exactly what I meant - http://lkml.org/lkml/2008/5/11/120 ;)

#13 lore raw
Quoted 72 lines · Cyrill Gorcunov
Quoted 58 lines · Rafael J. Wysocki
Quoted 19 lines · Cyrill Gorcunov

[H. Peter Anvin - Sun, May 11, 2008 at 11:25:54AM -0700]

Quoted 18 lines
Quoted 16 lines · Cyrill Gorcunov

Hi Peter,
actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):
wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin" wakeup_code_end:
and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

   . = HEADER_OFFSET;
   .header : {
           ...
   }
   . = ALIGN(16);
   _end = .;
   /DISCARD/ ...
Quoted 7 lines
Quoted 4 lines

Yes, I believe that's correct.

-hpa

Thanks for review, Peter, I'll cook a patch and wait for Pavel's opinion ;-)

I've tested the appended one. If that's what you mean, we'll ask Ingo to take it.

Thanks,
Rafael

---
 arch/x86/kernel/acpi/realmode/wakeup.lds.S |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6/arch/x86/kernel/acpi/realmode/wakeup.lds.S
===================================================================

arch/x86/kernel/acpi/realmode/wakeup.lds.S +0 -5
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-       . = HEADER_OFFSET;
-       .header : {
-                *(.header)
-       }
-
       . = 0;
       .text : {
                *(.text*)
@@ -50,6 +45,11 @@ SECTIONS
               __bss_end = .;

arch/x86/kernel/acpi/realmode/wakeup.lds.S SECTIONS · line 55

Quoted 10 lines
arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -0
       }
 
+       . = HEADER_OFFSET;
+       .header : {
+                *(.header)
+       }
+
       . = ALIGN(16);
       _end = .;
 

Thanks Rafael,

Quoted 2 lines

it's exactly what I meant - http://lkml.org/lkml/2008/5/11/120 ;)

Heh, now we have even two patches (exactly the same in contents). So, Ingo, could you pick up any patch, please? ;-) (i'm in office now without access to my linux machine, so I can't send the patch with my and Rafael's sign-offs)

#14 lore raw
In reply to Rafael J. Wysocki
Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Cyrill Gorcunov

[H. Peter Anvin - Sun, May 11, 2008 at 11:25:54AM -0700]

Quoted 20 lines
Quoted 9 lines · Cyrill Gorcunov

Hi Peter,
actually I only doubt about exactly position of this headers - I mean meguess it better should be _before_ "_end" not after. Since the others script uses (acpi/wakeup_rm.S):
wakeup_code_start:
.incbin "arch/x86/kernel/acpi/realmode/wakeup.bin"
wakeup_code_end:
and kernel uses these wakeup_code_* marks to save/restore memory I think it should be like

Quoted 7 lines
	. = HEADER_OFFSET;
	.header : {
		...
	}
	. = ALIGN(16);
	_end = .;
	/DISCARD/ ...

Yes, I believe that's correct.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

-hpa

Thanks for review, Peter, I'll cook a patch and wait for Pavel's opinion ;-)

I've tested the appended one. If that's what you mean, we'll ask Ingo to take it.

ACK... and thanks!
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#15 lore raw
In reply to Cyrill Gorcunov
Quoted 66 lines · Cyrill Gorcunov

[Sam Ravnborg - Sat, May 10, 2008 at 11:16:02PM +0200]

| On Sat, May 10, 2008 at 01:25:53PM -0700, H. Peter Anvin wrote:
| > Mikael Pettersson wrote:
| > >
| > >The resulting kernel hasn't broken on me yet, however.
| > >
| > >A search through the LKML archives showed that this was reported
| > >for 2.6.25-rc3-mm1, but I couldn't find any discussion about it
| > >after that:
| > >
| > ><http://marc.info/?l=linux-kernel&m=120470303728010&w=2>
| > >
| > >The .config causing this warning is available in
| > ><http://user.it.uu.se/~mikpe/linux/ale/config-2.6.26-rc1>
| > >
| > 
| > This is because the organization of the file was changed, and the linker 
| > script wasn't changed to match:
| > 
| > SECTIONS
| > {
| >         . = HEADER_OFFSET;
| >         .header : {
| >                  *(.header)
| >         }
| > 
| >         . = 0;
| >         .text : {
| >                  *(.text*)
| >         }
| > 
| > This is crap; the sections should be listed *in order* so the linker can 
| > warn properly when something bad happens.
| > 
| > The code should be correct; reorganizing the linker script correctly 
| > should fix the problem.
| 
| I need Pavel to comment on this.
| Why we start with . equal 0x3f00 and then later as . equals 0x0000
| I dunno.
| I did not look into this part of the code back then - but I should anyway
| have seen this flaw in the linker script :-(
| 
| 	Sam

Should not it be something like
---

arch/x86/kernel/acpi/realmode/wakeup.lds.S +0 -5
index 22fab6c..cccf62d 100644
@@ -12,11 +12,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = HEADER_OFFSET;
-	.header : {
-		 *(.header)
-	}
-
 	. = 0;
 	.text : {
 		 *(.text*)
@@ -53,6 +48,11 @@ SECTIONS
 	. = ALIGN(16);

arch/x86/kernel/acpi/realmode/wakeup.lds.S SECTIONS · line 58

Quoted 10 lines
arch/x86/kernel/acpi/realmode/wakeup.lds.S +5 -0
 	_end = .;
 
+	. = HEADER_OFFSET;
+	.header : {
+		 *(.header)
+	}
+
 	/DISCARD/ : {
 		*(.note*)
 	}

If it passes s2ram/resume test, it is probably correct ;-).
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html