Use gcc alias instead of assembler aliases for syscalls
PATCH 1/1 Use gcc alias instead of assembler aliases for syscalls
From: Andi Kleen <[email protected]>
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.
--- include/linux/compat.h | 4 ++-- include/linux/syscalls.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/compat.h +2 -2
@@ -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
include/linux/syscalls.h +2 -2
@@ -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);
Signature · 1 line
1.8.3.1
Quoted 6 lines · On Mon, 5 Aug 2013 15:09:35 -0700 Andi Kleen <[email protected]> wrote:
From: Andi Kleen <[email protected]>
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.
include/linux/compat.h line 50
Quoted 4 lines
include/linux/compat.h +0
-1{ \ 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?
Quoted 10 lines · Andrew Morton
Quoted 6 lines · On Mon, 5 Aug 2013 15:09:35 -0700 Andi Kleen <[email protected]> wrote:
From: Andi Kleen <[email protected]>
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
Quoted 7 lines
include/linux/compat.h line 50
Quoted 5 lines
include/linux/compat.h +0
-1{ \ 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_ALIASdefinitions?
Yes will send a followon patch.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 5 lines · Andi Kleen
Quoted 4 lines · Andrew Morton
Quoted 2 lines · On Mon, 5 Aug 2013 15:09:35 -0700 Andi Kleen <[email protected]> wrote:
From: Andi Kleen <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
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?
Quoted 7 lines · On Mon, 5 Aug 2013 15:09:35 -0700 Andi Kleen <[email protected]> wrote:
From: Andi Kleen <[email protected]>
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.
Quoted 11 lines · Andrew Morton
Quoted 7 lines · On Mon, 5 Aug 2013 15:09:35 -0700 Andi Kleen <[email protected]> wrote:
From: Andi Kleen <[email protected]>
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_64allmodconfig 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