LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86: fix usage of .section .sched.text in assembler code
@ 2008-01-26 22:53 Sam Ravnborg
  2008-01-28 10:13 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2008-01-26 22:53 UTC (permalink / raw)
  To: Ingo Molnar, LKML

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.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
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(-)

diff --git a/arch/x86/lib/semaphore_32.S b/arch/x86/lib/semaphore_32.S
index 444fba4..1edb5f2 100644
--- a/arch/x86/lib/semaphore_32.S
+++ b/arch/x86/lib/semaphore_32.S
@@ -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
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S
index 6ea73f3..8b92d42 100644
--- a/arch/x86/lib/thunk_64.S
+++ b/arch/x86/lib/thunk_64.S
@@ -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
-- 
1.5.4.rc3.14.g44397


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: fix usage of .section .sched.text in assembler code
  2008-01-26 22:53 [PATCH] x86: fix usage of .section .sched.text in assembler code Sam Ravnborg
@ 2008-01-28 10:13 ` Ingo Molnar
  2008-01-28 18:52   ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2008-01-28 10:13 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Ingo Molnar, LKML, Thomas Gleixner, H. Peter Anvin


* Sam Ravnborg <sam@ravnborg.org> wrote:

> 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.

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: fix usage of .section .sched.text in assembler code
  2008-01-28 10:13 ` Ingo Molnar
@ 2008-01-28 18:52   ` Sam Ravnborg
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2008-01-28 18:52 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Ingo Molnar, LKML, Thomas Gleixner, H. Peter Anvin

On Mon, Jan 28, 2008 at 11:13:34AM +0100, Ingo Molnar wrote:
> 
> > 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:

diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index ff203dd..4ac87bf 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -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.

> 
> 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-28 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-26 22:53 [PATCH] x86: fix usage of .section .sched.text in assembler code Sam Ravnborg
2008-01-28 10:13 ` Ingo Molnar
2008-01-28 18:52   ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).