Skip to contentSkip to conversation

x86: fix usage of .section .sched.text in assembler code

PATCH Applied Sam Ravnborg 2 participants 3 messages Jan 26, 2008 – Jan 28, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix usage of .section .sched.text in assembler code

Without this patch the linker will generate a section named .sched.text.1 which is unexpected.
This is because the gcc generated section has "ax" but the assembler usage of .sched.text lacks the "ax" specifier.

It would be better to have a definition we could use from assembler code but I did not find a suitable header file for it.

---
build tested on 64 bit only but seems obviously correct.

 arch/x86/lib/semaphore_32.S |    2 +-
 arch/x86/lib/thunk_64.S     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/lib/semaphore_32.S +1 -1
index 444fba4..1edb5f2 100644
@@ -29,7 +29,7 @@
  * registers (%eax, %edx and %ecx) except %eax whish is either a return
  * value or just clobbered..
  */
-	.section .sched.text
+	.section .sched.text, "ax"
 ENTRY(__down_failed)
 	CFI_STARTPROC
 	FRAME
arch/x86/lib/thunk_64.S +1 -1
index 6ea73f3..8b92d42 100644
@@ -33,7 +33,7 @@
 	.endm
 	
 
-	.section .sched.text
+	.section .sched.text, "ax"
 #ifdef CONFIG_RWSEM_XCHGADD_ALGORITHM
 	thunk rwsem_down_read_failed_thunk,rwsem_down_read_failed
 	thunk rwsem_down_write_failed_thunk,rwsem_down_write_failed
Signature · 1 line
1.5.4.rc3.14.g44397
Applied
#1 lore raw
Quoted 4 lines · Sam Ravnborg

Without this patch the linker will generate a section named .sched.text.1 which is unexpected. This is because the gcc generated section has "ax" but the assembler usage of .sched.text lacks the "ax" specifier.

thanks, applied.

Quoted 2 lines

It would be better to have a definition we could use from assembler code but I did not find a suitable header file for it.

hm, include/asm-x86/linkage.h?

btw., i guess this in include/linux/linkage.h:

#ifndef __ALIGN
#define __ALIGN .align 4,0x90
#define __ALIGN_STR ".align 4,0x90"
#endif

is an x86-ism (0x90 is the x86 NOP instruction) that should move into include/asm-x86/linkge.h and the default filler should be 0x00 instead?

Ingo

#2 lore raw
Quoted 5 lines · Ingo Molnar
Quoted 3 lines

It would be better to have a definition we could use from assembler code but I did not find a suitable header file for it.

hm, include/asm-x86/linkage.h?

No - it is for general use so it should live in include/linux/* Suggestion:

include/linux/linkage.h +9 -0
index ff203dd..4ac87bf 100644
@@ -48,6 +48,15 @@
   END(name);		 \
   .popsection
 
+#define SCHED_ENTRY(name)				\
+	.pushsection .sched.text, "ax", %progbits;	\
+	ENTRY(name)
+
+#define SCHED_END(name)	\
+	END(name);	\
+	.popsection
+
+
 #ifndef END
 #define END(name) \
   .size name, .-name

Note - the use of '%' is due to '@' is a comment identifier on arm and '%' seems to works across all arch's assemblers.

Quoted 10 lines

btw., i guess this in include/linux/linkage.h:

#ifndef __ALIGN
#define __ALIGN .align 4,0x90
#define __ALIGN_STR ".align 4,0x90"
#endif

is an x86-ism (0x90 is the x86 NOP instruction) that should move into include/asm-x86/linkge.h and the default filler should be 0x00 instead?

To specialized for my knowledge..

Sam