public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use gcc alias instead of assembler aliases for syscalls
@ 2013-08-05 22:09 Andi Kleen
  2013-08-06  5:59 ` Andrew Morton
  2013-08-07 23:54 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2013-08-05 22:09 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Use standard gcc __attribute__((alias(foo))) to define
the syscall aliases instead of custom assembler macros.

This is far cleaner, and also fixes my LTO kernel build.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 include/linux/compat.h   | 4 ++--
 include/linux/syscalls.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 7f0c1dd..18e4b75 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -41,13 +41,13 @@
 	COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
 
 #define COMPAT_SYSCALL_DEFINEx(x, name, ...)				\
-	asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
+	asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
+		__attribute__((alias(__stringify(compat_SyS##name))));  \
 	static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
 	asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
 	{								\
 		return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));	\
 	}								\
-	SYSCALL_ALIAS(compat_sys##name, compat_SyS##name);		\
 	static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
 
 #ifndef compat_user_stack_pointer
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 4147d70..87039ad 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -184,7 +184,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
 
 #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
 #define __SYSCALL_DEFINEx(x, name, ...)					\
-	asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
+	asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))	\
+		__attribute__((alias(__stringify(SyS##name))));		\
 	static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
 	asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))	\
 	{								\
@@ -193,7 +194,6 @@ extern struct trace_event_functions exit_syscall_print_funcs;
 		__PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__));	\
 		return ret;						\
 	}								\
-	SYSCALL_ALIAS(sys##name, SyS##name);				\
 	static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
 
 asmlinkage long sys_time(time_t __user *tloc);
-- 
1.8.3.1


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

* Re: [PATCH] Use gcc alias instead of assembler aliases for syscalls
  2013-08-05 22:09 [PATCH] Use gcc alias instead of assembler aliases for syscalls Andi Kleen
@ 2013-08-06  5:59 ` Andrew Morton
  2013-08-06  6:42   ` Andi Kleen
  2013-08-07 23:54 ` Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2013-08-06  5:59 UTC (permalink / raw)
  To: Andi Kleen; +Cc: viro, linux-kernel, Andi Kleen

On Mon,  5 Aug 2013 15:09:35 -0700 Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> Use standard gcc __attribute__((alias(foo))) to define
> the syscall aliases instead of custom assembler macros.
> 
> This is far cleaner, and also fixes my LTO kernel build.

I wonder what gcc version this was added in.  Seems fairly longstanding.

>  	{								\
>  		return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));	\
>  	}								\
> -	SYSCALL_ALIAS(compat_sys##name, compat_SyS##name);		\

I think we can remove the SYSCALL_ALIAS definitions?



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

* Re: [PATCH] Use gcc alias instead of assembler aliases for syscalls
  2013-08-06  5:59 ` Andrew Morton
@ 2013-08-06  6:42   ` Andi Kleen
  2013-08-06  7:40     ` Al Viro
  0 siblings, 1 reply; 6+ messages in thread
From: Andi Kleen @ 2013-08-06  6:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, viro, linux-kernel, Andi Kleen

On Mon, Aug 05, 2013 at 10:59:49PM -0700, Andrew Morton wrote:
> On Mon,  5 Aug 2013 15:09:35 -0700 Andi Kleen <andi@firstfloor.org> wrote:
> 
> > From: Andi Kleen <ak@linux.intel.com>
> > 
> > Use standard gcc __attribute__((alias(foo))) to define
> > the syscall aliases instead of custom assembler macros.
> > 
> > This is far cleaner, and also fixes my LTO kernel build.
> 
> I wonder what gcc version this was added in.  Seems fairly longstanding.

Seems to be already in 2.95, so every kernel compiler

http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC90

> 
> >  	{								\
> >  		return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));	\
> >  	}								\
> > -	SYSCALL_ALIAS(compat_sys##name, compat_SyS##name);		\
> 
> I think we can remove the SYSCALL_ALIAS definitions?

Yes will send a followon patch.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

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

* Re: [PATCH] Use gcc alias instead of assembler aliases for syscalls
  2013-08-06  6:42   ` Andi Kleen
@ 2013-08-06  7:40     ` Al Viro
  0 siblings, 0 replies; 6+ messages in thread
From: Al Viro @ 2013-08-06  7:40 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-kernel, Andi Kleen, Geert Uytterhoeven

On Tue, Aug 06, 2013 at 08:42:01AM +0200, Andi Kleen wrote:
> On Mon, Aug 05, 2013 at 10:59:49PM -0700, Andrew Morton wrote:
> > On Mon,  5 Aug 2013 15:09:35 -0700 Andi Kleen <andi@firstfloor.org> wrote:
> > 
> > > From: Andi Kleen <ak@linux.intel.com>
> > > 
> > > Use standard gcc __attribute__((alias(foo))) to define
> > > the syscall aliases instead of custom assembler macros.
> > > 
> > > This is far cleaner, and also fixes my LTO kernel build.
> > 
> > I wonder what gcc version this was added in.  Seems fairly longstanding.
> 
> Seems to be already in 2.95, so every kernel compiler

IIRC, there had been some architectures where it didn't work correctly.
I don't remember details, though...   Geert?

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

* Re: [PATCH] Use gcc alias instead of assembler aliases for syscalls
  2013-08-05 22:09 [PATCH] Use gcc alias instead of assembler aliases for syscalls Andi Kleen
  2013-08-06  5:59 ` Andrew Morton
@ 2013-08-07 23:54 ` Andrew Morton
  2013-08-08  4:39   ` Andi Kleen
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2013-08-07 23:54 UTC (permalink / raw)
  To: Andi Kleen; +Cc: viro, linux-kernel, Andi Kleen

On Mon,  5 Aug 2013 15:09:35 -0700 Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> Use standard gcc __attribute__((alias(foo))) to define
> the syscall aliases instead of custom assembler macros.
> 
> This is far cleaner, and also fixes my LTO kernel build.
> 

This makes my x86_64 allmodconfig build emit screenfuls of

...
WARNING: "alloc_pages_current" [drivers/block/brd.ko] has no CRC!
WARNING: "alloc_pages_current" [drivers/base/firmware_class.ko] has no CRC!
WARNING: "schedule_timeout" [drivers/atm/solos-pci.ko] has no CRC!
WARNING: "schedule_timeout" [drivers/atm/iphase.ko] has no CRC!
WARNING: "schedule_timeout" [drivers/atm/he.ko] has no CRC!
WARNING: "schedule_timeout" [drivers/acpi/sbshc.ko] has no CRC!
WARNING: "schedule_timeout" [drivers/acpi/acpi_ipmi.ko] has no CRC!
WARNING: "alloc_pages_current" [crypto/async_tx/raid6test.ko] has no CRC!
WARNING: "alloc_pages_current" [crypto/async_tx/async_pq.ko] has no CRC!
WARNING: "alloc_pages_current" [crypto/algif_skcipher.ko] has no CRC!
WARNING: "schedule_timeout" [crypto/algif_skcipher.ko] has no CRC!
WARNING: "sock_register" [crypto/af_alg.ko] has no CRC!
WARNING: "task_nice" [block/cfq-iosched.ko] has no CRC!
WARNING: "perf_event_create_kernel_counter" [arch/x86/oprofile/oprofile.ko] has no CRC!
WARNING: "alloc_pages_current" [arch/x86/kvm/kvm.ko] has no CRC!
WARNING: "perf_event_create_kernel_counter" [arch/x86/kvm/kvm.ko] has no CRC!
WARNING: "alloc_pages_current" [arch/x86/kvm/kvm-amd.ko] has no CRC!
WARNING: "schedule_timeout" [arch/x86/kernel/cpu/mcheck/mce-inject.ko] has no CRC!
WARNING: "schedule_timeout" [arch/x86/kernel/apm.ko] has no CRC!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2


Unexpected, but I checked it a couple of times.

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

* Re: [PATCH] Use gcc alias instead of assembler aliases for syscalls
  2013-08-07 23:54 ` Andrew Morton
@ 2013-08-08  4:39   ` Andi Kleen
  0 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2013-08-08  4:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, viro, linux-kernel

On Wed, Aug 07, 2013 at 04:54:21PM -0700, Andrew Morton wrote:
> On Mon,  5 Aug 2013 15:09:35 -0700 Andi Kleen <andi@firstfloor.org> wrote:
> 
> > From: Andi Kleen <ak@linux.intel.com>
> > 
> > Use standard gcc __attribute__((alias(foo))) to define
> > the syscall aliases instead of custom assembler macros.
> > 
> > This is far cleaner, and also fixes my LTO kernel build.
> > 
> 
> This makes my x86_64 allmodconfig build emit screenfuls of

Ok I can reproduce with MODVERSIONS. Very mysterious, as I 
didn't change EXPORT_SYMBOL. Will look into it.

Thanks.

-Andi

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

end of thread, other threads:[~2013-08-08  4:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 22:09 [PATCH] Use gcc alias instead of assembler aliases for syscalls Andi Kleen
2013-08-06  5:59 ` Andrew Morton
2013-08-06  6:42   ` Andi Kleen
2013-08-06  7:40     ` Al Viro
2013-08-07 23:54 ` Andrew Morton
2013-08-08  4:39   ` Andi Kleen

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