public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* Fw: [PATCH] abstract type/size specification for assembly
@ 2006-01-31 22:31 Andrew Morton
  2006-02-01  7:36 ` Andi Kleen
  2006-02-01 13:50 ` Ralf Baechle
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Morton @ 2006-01-31 22:31 UTC (permalink / raw)
  To: linux-arch; +Cc: Jan Beulich

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]


OK?



From: Jan Beulich <jbeulich@novell.com>

Provide abstraction for generating type and size information of assembly
routines and data.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/linux/linkage.h |    5 +++++
 1 files changed, 5 insertions(+)

diff -puN include/linux/linkage.h~abstract-type-size-specification-for-assembly include/linux/linkage.h
--- 25/include/linux/linkage.h~abstract-type-size-specification-for-assembly	Tue Jan 31 14:30:58 2006
+++ 25-akpm/include/linux/linkage.h	Tue Jan 31 14:30:58 2006
@@ -39,6 +39,11 @@
   ALIGN; \
   name:
 
+#define ENDPROC(name) \
+  .type name, @function; \
+  END(name)
+#define END(name) \
+  .size name, .-name
 
 #endif
 
_


[-- Attachment #2: linux-2.6.16-rc1-end-endproc.patch --]
[-- Type: text/plain, Size: 653 bytes --]

From: Jan Beulich <jbeulich@novell.com>

Provide abstraction for generating type and size information of
assembly routines and data.

Signed-Off-By: Jan Beulich <jbeulich@novell.com>

diff -Npru /home/jbeulich/tmp/linux-2.6.16-rc1/include/linux/linkage.h 2.6.16-rc1-end-endproc/include/linux/linkage.h
--- /home/jbeulich/tmp/linux-2.6.16-rc1/include/linux/linkage.h	2006-01-03 04:21:10.000000000 +0100
+++ 2.6.16-rc1-end-endproc/include/linux/linkage.h	2006-01-25 10:41:49.000000000 +0100
@@ -39,6 +39,11 @@
   ALIGN; \
   name:
 
+#define ENDPROC(name) \
+  .type name, @function; \
+  END(name)
+#define END(name) \
+  .size name, .-name
 
 #endif
 


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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-01-31 22:31 Fw: [PATCH] abstract type/size specification for assembly Andrew Morton
@ 2006-02-01  7:36 ` Andi Kleen
  2006-02-01  8:32   ` Russell King
  2006-02-01 13:50 ` Ralf Baechle
  1 sibling, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2006-02-01  7:36 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, Jan Beulich

On Tuesday 31 January 2006 23:31, Andrew Morton wrote:
> 
> OK?

Yes.

> 
> 
> From: Jan Beulich <jbeulich@novell.com>
> 
> Provide abstraction for generating type and size information of assembly
> routines and data.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
> 
>  include/linux/linkage.h |    5 +++++
>  1 files changed, 5 insertions(+)
> 
> diff -puN include/linux/linkage.h~abstract-type-size-specification-for-assembly include/linux/linkage.h
> --- 25/include/linux/linkage.h~abstract-type-size-specification-for-assembly	Tue Jan 31 14:30:58 2006
> +++ 25-akpm/include/linux/linkage.h	Tue Jan 31 14:30:58 2006
> @@ -39,6 +39,11 @@
>    ALIGN; \
>    name:
>  
> +#define ENDPROC(name) \
> +  .type name, @function; \
> +  END(name)
> +#define END(name) \
> +  .size name, .-name
>  
>  #endif
>  
> _
> 
> 

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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-02-01  7:36 ` Andi Kleen
@ 2006-02-01  8:32   ` Russell King
  2006-02-01  8:49     ` Andi Kleen
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Russell King @ 2006-02-01  8:32 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-arch, Jan Beulich

On Wed, Feb 01, 2006 at 08:36:09AM +0100, Andi Kleen wrote:
> On Tuesday 31 January 2006 23:31, Andrew Morton wrote:
> > 
> > OK?
> 
> Yes.

No.

> > +#define ENDPROC(name) \
> > +  .type name, @function; \
> > +  END(name)
> > +#define END(name) \
> > +  .size name, .-name

@ is the comment character on ARM, so this can't go here - we use

	.type name, %function

instead.  Interestingly, the info pages for as seem to indicate that
there's a number of alternatives - maybe the most benign one should
be used, iow:

	.type name, "function"

or alternatively make ENDPROC arch-overridable.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-02-01  8:32   ` Russell King
@ 2006-02-01  8:49     ` Andi Kleen
  2006-02-01  9:09       ` Russell King
  2006-02-01 11:40     ` Jan Beulich
  2006-02-08 16:11     ` Jan Beulich
  2 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2006-02-01  8:49 UTC (permalink / raw)
  To: Russell King; +Cc: Andrew Morton, linux-arch, Jan Beulich

On Wednesday 01 February 2006 09:32, Russell King wrote:

> @ is the comment character on ARM, so this can't go here - we use
> 
> 	.type name, %function
> 
> instead.  Interestingly, the info pages for as seem to indicate that
> there's a number of alternatives - maybe the most benign one should
> be used, iow:
> 
> 	.type name, "function"
> 
> or alternatively make ENDPROC arch-overridable.

Actually it could be just per architecture. Or do you see ARM specific
assembly code using ENDPROC() any time soon? And there are no portable
assembly files.

I assume Jan only wants/needs it for x86(-32/64) and perhaps ia64/ppc.

-Andi

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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-02-01  8:49     ` Andi Kleen
@ 2006-02-01  9:09       ` Russell King
  0 siblings, 0 replies; 8+ messages in thread
From: Russell King @ 2006-02-01  9:09 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-arch, Jan Beulich

On Wed, Feb 01, 2006 at 09:49:18AM +0100, Andi Kleen wrote:
> On Wednesday 01 February 2006 09:32, Russell King wrote:
> 
> > @ is the comment character on ARM, so this can't go here - we use
> > 
> > 	.type name, %function
> > 
> > instead.  Interestingly, the info pages for as seem to indicate that
> > there's a number of alternatives - maybe the most benign one should
> > be used, iow:
> > 
> > 	.type name, "function"
> > 
> > or alternatively make ENDPROC arch-overridable.
> 
> Actually it could be just per architecture. Or do you see ARM specific
> assembly code using ENDPROC() any time soon? And there are no portable
> assembly files.

I do have a number of .type and .size stuff in the ARM assembly files -
it aids objdump in working out whether it should dump the contents as
data or code.  IOW, it might be useful to have.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-02-01  8:32   ` Russell King
  2006-02-01  8:49     ` Andi Kleen
@ 2006-02-01 11:40     ` Jan Beulich
  2006-02-08 16:11     ` Jan Beulich
  2 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2006-02-01 11:40 UTC (permalink / raw)
  To: Russell King; +Cc: Andrew Morton, Andi Kleen, linux-arch

>>> Russell King <rmk@arm.linux.org.uk> 01.02.06 09:32:43 >>>
>@ is the comment character on ARM, so this can't go here - we use
>
>	.type name, %function
>
>instead.

Bad.

>Interestingly, the info pages for as seem to indicate that
>there's a number of alternatives - maybe the most benign one should
>be used, iow:
>
>	.type name, "function"

While gas seems to generally accept it, ias doesn't (and the assembly language spec for ia64 doesn't either).

>or alternatively make ENDPROC arch-overridable.

That seems to be the only choice then. I'll send a revised patch soon.

Jan

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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-01-31 22:31 Fw: [PATCH] abstract type/size specification for assembly Andrew Morton
  2006-02-01  7:36 ` Andi Kleen
@ 2006-02-01 13:50 ` Ralf Baechle
  1 sibling, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2006-02-01 13:50 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, Jan Beulich

On Tue, Jan 31, 2006 at 02:31:49PM -0800, Andrew Morton wrote:

> OK?

No.

> diff -puN include/linux/linkage.h~abstract-type-size-specification-for-assembly include/linux/linkage.h
> --- 25/include/linux/linkage.h~abstract-type-size-specification-for-assembly	Tue Jan 31 14:30:58 2006
> +++ 25-akpm/include/linux/linkage.h	Tue Jan 31 14:30:58 2006
> @@ -39,6 +39,11 @@
>    ALIGN; \
>    name:
>  
> +#define ENDPROC(name) \
> +  .type name, @function; \
> +  END(name)
> +#define END(name) \
> +  .size name, .-name
>  
>  #endif

No.  On MIPS we need a .end directive as well; since the dawn of Linux I
have the following in include/asm-mips/asm.h:

#define END(function)                                   \
                .end    function;                       \
                .size   function,.-function

And while we're at it, the ENTRY definition there isn't usable on MIPS
either; we need two different definitions for leaf and no-leaf functions
which again are in asm.h:

/*
 * LEAF - declare leaf routine
 */
#define LEAF(symbol)                                    \
                .globl  symbol;                         \
                .align  2;                              \
                .type   symbol,@function;               \
                .ent    symbol,0;                       \
symbol:         .frame  sp,0,ra

/*
 * NESTED - declare nested routine entry point
 */
#define NESTED(symbol, framesize, rpc)                  \
                .globl  symbol;                         \
                .align  2;                              \
                .type   symbol,@function;               \
                .ent    symbol,0;                       \
symbol:         .frame  sp, framesize, rpc

  Ralf

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

* Re: Fw: [PATCH] abstract type/size specification for assembly
  2006-02-01  8:32   ` Russell King
  2006-02-01  8:49     ` Andi Kleen
  2006-02-01 11:40     ` Jan Beulich
@ 2006-02-08 16:11     ` Jan Beulich
  2 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2006-02-08 16:11 UTC (permalink / raw)
  To: Russell King, ralf, Andrew Morton, Andi Kleen; +Cc: linux-arch

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

Attached an updated patch.

>>> Russell King <rmk@arm.linux.org.uk> 01.02.06 09:32:43 >>>
On Wed, Feb 01, 2006 at 08:36:09AM +0100, Andi Kleen wrote:
> On Tuesday 31 January 2006 23:31, Andrew Morton wrote:
> > 
> > OK?
> 
> Yes.

No.

> > +#define ENDPROC(name) \
> > +  .type name, @function; \
> > +  END(name)
> > +#define END(name) \
> > +  .size name, .-name

@ is the comment character on ARM, so this can't go here - we use

	.type name, %function

instead.  Interestingly, the info pages for as seem to indicate that
there's a number of alternatives - maybe the most benign one should
be used, iow:

	.type name, "function"

or alternatively make ENDPROC arch-overridable.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/ 
 maintainer of:  2.6 Serial core

[-- Attachment #2: linux-2.6.16-rc2-end-endproc.patch --]
[-- Type: text/plain, Size: 2507 bytes --]

From: Jan Beulich <jbeulich@novell.com>

Updated patch, to provide abstraction for generating type and size information
of assembly routines and data, while permitting architectures to override
these defaults.

Signed-Off-By: Jan Beulich <jbeulich@novell.com>

diff -Npru /home/jbeulich/tmp/linux-2.6.16-rc2/include/asm-ia64/linkage.h 2.6.16-rc2-end-endproc/include/asm-ia64/linkage.h
--- /home/jbeulich/tmp/linux-2.6.16-rc2/include/asm-ia64/linkage.h	2006-01-03 04:21:10.000000000 +0100
+++ 2.6.16-rc2-end-endproc/include/asm-ia64/linkage.h	2006-02-06 12:00:44.000000000 +0100
@@ -1,6 +1,14 @@
 #ifndef __ASM_LINKAGE_H
 #define __ASM_LINKAGE_H
 
+#ifndef __ASSEMBLY__
+
 #define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage))
 
+#else
+
+#include <asm/asmmacro.h>
+
+#endif
+
 #endif
diff -Npru /home/jbeulich/tmp/linux-2.6.16-rc2/include/asm-mips/linkage.h 2.6.16-rc2-end-endproc/include/asm-mips/linkage.h
--- /home/jbeulich/tmp/linux-2.6.16-rc2/include/asm-mips/linkage.h	2006-01-03 04:21:10.000000000 +0100
+++ 2.6.16-rc2-end-endproc/include/asm-mips/linkage.h	2006-02-06 12:01:44.000000000 +0100
@@ -1,6 +1,8 @@
 #ifndef __ASM_LINKAGE_H
 #define __ASM_LINKAGE_H
 
-/* Nothing to see here... */
+#ifdef __ASSEMBLY__
+#include <asm/asm.h>
+#endif
 
 #endif
diff -Npru /home/jbeulich/tmp/linux-2.6.16-rc2/include/asm-v850/linkage.h 2.6.16-rc2-end-endproc/include/asm-v850/linkage.h
--- /home/jbeulich/tmp/linux-2.6.16-rc2/include/asm-v850/linkage.h	2006-01-03 04:21:10.000000000 +0100
+++ 2.6.16-rc2-end-endproc/include/asm-v850/linkage.h	2006-02-06 12:03:21.000000000 +0100
@@ -1,6 +1,8 @@
 #ifndef __ASM_LINKAGE_H
 #define __ASM_LINKAGE_H
 
-/* Nothing to see here... */
+#ifdef __ASSEMBLY__
+#include <asm/asm.h>
+#endif
 
 #endif
diff -Npru /home/jbeulich/tmp/linux-2.6.16-rc2/include/linux/linkage.h 2.6.16-rc2-end-endproc/include/linux/linkage.h
--- /home/jbeulich/tmp/linux-2.6.16-rc2/include/linux/linkage.h	2006-01-03 04:21:10.000000000 +0100
+++ 2.6.16-rc2-end-endproc/include/linux/linkage.h	2006-02-06 12:04:32.000000000 +0100
@@ -28,17 +28,27 @@
 #define ALIGN __ALIGN
 #define ALIGN_STR __ALIGN_STR
 
+#ifndef ENTRY
 #define ENTRY(name) \
   .globl name; \
   ALIGN; \
   name:
+#endif
 
 #define KPROBE_ENTRY(name) \
   .section .kprobes.text, "ax"; \
-  .globl name; \
-  ALIGN; \
-  name:
+  ENTRY(name)
 
+#ifndef END
+#define END(name) \
+  .size name, .-name
+#endif
+
+#ifndef ENDPROC
+#define ENDPROC(name) \
+  .type name, @function; \
+  END(name)
+#endif
 
 #endif
 

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

end of thread, other threads:[~2006-02-08 16:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-31 22:31 Fw: [PATCH] abstract type/size specification for assembly Andrew Morton
2006-02-01  7:36 ` Andi Kleen
2006-02-01  8:32   ` Russell King
2006-02-01  8:49     ` Andi Kleen
2006-02-01  9:09       ` Russell King
2006-02-01 11:40     ` Jan Beulich
2006-02-08 16:11     ` Jan Beulich
2006-02-01 13:50 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox