Skip to contentSkip to conversation

x86 build issue with software suspend code

DISCUSSION Pavel Machek 1 participant 1 message Aug 28, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi!

Quoted 6 lines

A piece of code most like "copy-and-paste"d from x86_64 to i386 caused the section named .data.nosave in arch/i386/power/swsusp.S to become named .data.nosave.1 in arch/i386/power/built-in.o (due to an attribute collision with an identically named section from arch/i386/power/cpu.c),

I can't find anything about nosave section in cpu.c... Can you quote it?

Quoted 8 lines

which finally ends up in no-where land (because it doesn't have even the alloc bit set, and the linker script doesn't know about such a section either), resulting in the two variables being accessed at (absolute) addresses 0 and 8 (which shouldn't normally be accessible at all, but perhaps are mapped for whatever reason at the point execution gets there, since otherwise problems with this code path should have been observed much earlier).

Quoted 6 lines

The below (also attached for the inline variant most certainly getting incorrectly line wrapped) patch changes the attributes of the section to match those of other instances of the section, so the renaming doesn't happen anymore. It also adds alignment, decreases the fields from 8 to 4 bytes and applies these additional changes also to the appearant original x86_64 code.

I do not know that much about linker, but patch looks okay.
Pavel

Quoted 38 lines

diff -Napru linux-2.6.8.1/arch/i386/power/swsusp.S 2.6.8.1/arch/i386/power/swsusp.S
--- linux-2.6.8.1/arch/i386/power/swsusp.S 2004-08-14
12:55:19.000000000 +0200
+++ 2.6.8.1/arch/i386/power/swsusp.S 2004-08-26 15:54:35.420154440
+0200

(quoted diff) +4 -3
@@ -89,9 +89,10 @@ copy_done:
 	popl %ebx
 	ret
 
-       .section .data.nosave
+       .section .data.nosave, "aw"
+       .align 4
 loop:
-       .quad 0
+       .long 0
 loop2:
-       .quad 0
+       .long 0
        .previous

diff -Napru linux-2.6.8.1/arch/x86_64/kernel/suspend_asm.S 2.6.8.1/arch/x86_64/kernel/suspend_asm.S
--- linux-2.6.8.1/arch/x86_64/kernel/suspend_asm.S 2004-08-14
12:56:22.000000000 +0200
+++ 2.6.8.1/arch/x86_64/kernel/suspend_asm.S 2004-08-26
15:54:56.446957880 +0200

(quoted diff) +2 -1
@@ -117,7 +117,8 @@ ENTRY(do_magic)
 	addq	$8, %rsp
 	jmp	do_magic_resume_2
 
-	.section .data.nosave
+	.section .data.nosave, "aw"
+	.align 8
 loop:
 	.quad 0
 loop2:	
Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!