Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

consolidate cond_syscall and SYSCALL_ALIAS declarations

take them to asm/linkage.h, with default in linux/linkage.h

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro e1b5bb6d 4a0fd5bf

+44 -209
+3 -1
arch/alpha/include/asm/linkage.h
··· 1 1 #ifndef __ASM_LINKAGE_H 2 2 #define __ASM_LINKAGE_H 3 3 4 - /* Nothing to see here... */ 4 + #define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall") 5 + #define SYSCALL_ALIAS(alias, name) \ 6 + asm ( #alias " = " #name "\n\t.globl " #alias) 5 7 6 8 #endif
-12
arch/alpha/include/asm/unistd.h
··· 18 18 #define __ARCH_WANT_SYS_VFORK 19 19 #define __ARCH_WANT_SYS_CLONE 20 20 21 - /* "Conditional" syscalls. What we want is 22 - 23 - __attribute__((weak,alias("sys_ni_syscall"))) 24 - 25 - but that raises the problem of what type to give the symbol. If we use 26 - a prototype, it'll conflict with the definition given in this file and 27 - others. If we use __typeof, we discover that not all symbols actually 28 - have declarations. If we use no prototype, then we get warnings from 29 - -Wstrict-prototypes. Ho hum. */ 30 - 31 - #define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall") 32 - 33 21 #endif /* _ALPHA_UNISTD_H */
-8
arch/arm/include/asm/unistd.h
··· 44 44 #define __ARCH_WANT_SYS_CLONE 45 45 46 46 /* 47 - * "Conditional" syscalls 48 - * 49 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 50 - * but it doesn't work on all toolchains, so we just do it by hand 51 - */ 52 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 53 - 54 - /* 55 47 * Unimplemented (or alternatively implemented) syscalls 56 48 */ 57 49 #define __IGNORE_fadvise64_64
-8
arch/avr32/include/asm/unistd.h
··· 41 41 #define __ARCH_WANT_SYS_VFORK 42 42 #define __ARCH_WANT_SYS_CLONE 43 43 44 - /* 45 - * "Conditional" syscalls 46 - * 47 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 48 - * but it doesn't work on all toolchains, so we just do it by hand 49 - */ 50 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); 51 - 52 44 #endif /* __ASM_AVR32_UNISTD_H */
-8
arch/blackfin/include/asm/unistd.h
··· 20 20 #define __ARCH_WANT_SYS_NICE 21 21 #define __ARCH_WANT_SYS_VFORK 22 22 23 - /* 24 - * "Conditional" syscalls 25 - * 26 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 27 - * but it doesn't work on all toolchains, so we just do it by hand 28 - */ 29 - #define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall"); 30 - 31 23 #endif /* __ASM_BFIN_UNISTD_H */
-8
arch/cris/include/asm/unistd.h
··· 34 34 #define __ARCH_WANT_SYS_VFORK 35 35 #define __ARCH_WANT_SYS_CLONE 36 36 37 - /* 38 - * "Conditional" syscalls 39 - * 40 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 41 - * but it doesn't work on all toolchains, so we just do it by hand 42 - */ 43 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 44 - 45 37 #endif /* _ASM_CRIS_UNISTD_H_ */
-10
arch/frv/include/asm/unistd.h
··· 31 31 #define __ARCH_WANT_SYS_VFORK 32 32 #define __ARCH_WANT_SYS_CLONE 33 33 34 - /* 35 - * "Conditional" syscalls 36 - * 37 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 38 - * but it doesn't work on all toolchains, so we just do it by hand 39 - */ 40 - #ifndef cond_syscall 41 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 42 - #endif 43 - 44 34 #endif /* _ASM_UNISTD_H_ */
-2
arch/h8300/include/asm/linkage.h
··· 2 2 #define _H8300_LINKAGE_H 3 3 4 4 #undef SYMBOL_NAME_LABEL 5 - #undef SYMBOL_NAME 6 5 #define SYMBOL_NAME_LABEL(_name_) _##_name_##: 7 - #define SYMBOL_NAME(_name_) _##_name_ 8 6 #endif
-7
arch/h8300/include/asm/unistd.h
··· 33 33 #define __ARCH_WANT_SYS_VFORK 34 34 #define __ARCH_WANT_SYS_CLONE 35 35 36 - /* 37 - * "Conditional" syscalls 38 - */ 39 - #define cond_syscall(name) \ 40 - asm (".weak\t_" #name "\n" \ 41 - ".set\t_" #name ",_sys_ni_syscall"); 42 - 43 36 #endif /* _ASM_H8300_UNISTD_H_ */
+4
arch/ia64/include/asm/linkage.h
··· 11 11 12 12 #endif 13 13 14 + #define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#") 15 + #define SYSCALL_ALIAS(alias, name) \ 16 + asm ( #alias "# = " #name "#\n\t.globl " #alias "#") 17 + 14 18 #endif
-10
arch/ia64/include/asm/unistd.h
··· 46 46 struct pt_regs; 47 47 asmlinkage long sys_ia64_pipe(void); 48 48 49 - /* 50 - * "Conditional" syscalls 51 - * 52 - * Note, this macro can only be used in the file which defines sys_ni_syscall, i.e., in 53 - * kernel/sys_ni.c. This version causes warnings because the declaration isn't a 54 - * proper prototype, but we can't use __typeof__ either, because not all cond_syscall() 55 - * declarations have prototypes at the moment. 56 - */ 57 - #define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall"))) 58 - 59 49 #endif /* !__ASSEMBLY__ */ 60 50 #endif /* _ASM_IA64_UNISTD_H */
-10
arch/m32r/include/asm/unistd.h
··· 48 48 #define __IGNORE_getresgid 49 49 #define __IGNORE_chown 50 50 51 - /* 52 - * "Conditional" syscalls 53 - * 54 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 55 - * but it doesn't work on all toolchains, so we just do it by hand 56 - */ 57 - #ifndef cond_syscall 58 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 59 - #endif 60 - 61 51 #endif /* _ASM_M32R_UNISTD_H */
-8
arch/m68k/include/asm/unistd.h
··· 32 32 #define __ARCH_WANT_SYS_FORK 33 33 #define __ARCH_WANT_SYS_VFORK 34 34 35 - /* 36 - * "Conditional" syscalls 37 - * 38 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 39 - * but it doesn't work on all toolchains, so we just do it by hand 40 - */ 41 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 42 - 43 35 #endif /* _ASM_M68K_UNISTD_H_ */
-8
arch/microblaze/include/asm/unistd.h
··· 37 37 #define __ARCH_WANT_SYS_VFORK 38 38 #define __ARCH_WANT_SYS_FORK 39 39 40 - /* 41 - * "Conditional" syscalls 42 - * 43 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 44 - * but it doesn't work on all toolchains, so we just do it by hand 45 - */ 46 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); 47 - 48 40 #endif /* __ASSEMBLY__ */ 49 41 #endif /* _ASM_MICROBLAZE_UNISTD_H */
+3
arch/mips/include/asm/linkage.h
··· 6 6 #endif 7 7 8 8 #define __weak __attribute__((weak)) 9 + #define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall") 10 + #define SYSCALL_ALIAS(alias, name) \ 11 + asm ( #alias " = " #name "\n\t.globl " #alias) 9 12 10 13 #endif
-8
arch/mips/include/asm/unistd.h
··· 63 63 64 64 #endif /* !__ASSEMBLY__ */ 65 65 66 - /* 67 - * "Conditional" syscalls 68 - * 69 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 70 - * but it doesn't work on all toolchains, so we just do it by hand 71 - */ 72 - #define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall") 73 - 74 66 #endif /* _ASM_UNISTD_H */
-10
arch/mn10300/include/asm/unistd.h
··· 45 45 #define __ARCH_WANT_SYS_VFORK 46 46 #define __ARCH_WANT_SYS_CLONE 47 47 48 - /* 49 - * "Conditional" syscalls 50 - * 51 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 52 - * but it doesn't work on all toolchains, so we just do it by hand 53 - */ 54 - #ifndef cond_syscall 55 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); 56 - #endif 57 - 58 48 #endif /* _ASM_UNISTD_H */
-8
arch/parisc/include/asm/unistd.h
··· 170 170 171 171 #undef STR 172 172 173 - /* 174 - * "Conditional" syscalls 175 - * 176 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 177 - * but it doesn't work on all toolchains, so we just do it by hand 178 - */ 179 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 180 - 181 173 #endif /* _ASM_PARISC_UNISTD_H_ */
+13
arch/powerpc/include/asm/linkage.h
··· 1 + #ifndef _ASM_POWERPC_LINKAGE_H 2 + #define _ASM_POWERPC_LINKAGE_H 3 + 4 + #ifdef CONFIG_PPC64 5 + #define cond_syscall(x) \ 6 + asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \ 7 + "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n") 8 + #define SYSCALL_ALIAS(alias, name) \ 9 + asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ 10 + "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) 11 + #endif 12 + 13 + #endif /* _ASM_POWERPC_LINKAGE_H */
-6
arch/powerpc/include/asm/unistd.h
··· 56 56 #define __ARCH_WANT_SYS_VFORK 57 57 #define __ARCH_WANT_SYS_CLONE 58 58 59 - /* 60 - * "Conditional" syscalls 61 - */ 62 - #define cond_syscall(x) \ 63 - asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall"))) 64 - 65 59 #endif /* __ASSEMBLY__ */ 66 60 #endif /* _ASM_POWERPC_UNISTD_H_ */
-6
arch/powerpc/include/uapi/asm/linkage.h
··· 1 - #ifndef _ASM_POWERPC_LINKAGE_H 2 - #define _ASM_POWERPC_LINKAGE_H 3 - 4 - /* Nothing to see here... */ 5 - 6 - #endif /* _ASM_POWERPC_LINKAGE_H */
-8
arch/s390/include/asm/unistd.h
··· 54 54 #define __ARCH_WANT_SYS_VFORK 55 55 #define __ARCH_WANT_SYS_CLONE 56 56 57 - /* 58 - * "Conditional" syscalls 59 - * 60 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 61 - * but it doesn't work on all toolchains, so we just do it by hand 62 - */ 63 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 64 - 65 57 #endif /* _ASM_S390_UNISTD_H_ */
-8
arch/sh/include/asm/unistd.h
··· 30 30 # define __ARCH_WANT_SYS_VFORK 31 31 # define __ARCH_WANT_SYS_CLONE 32 32 33 - /* 34 - * "Conditional" syscalls 35 - * 36 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 37 - * but it doesn't work on all toolchains, so we just do it by hand 38 - */ 39 - # define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 40 - 41 33 #include <uapi/asm/unistd.h>
-8
arch/sparc/include/asm/unistd.h
··· 45 45 #define __ARCH_WANT_COMPAT_SYS_SENDFILE 46 46 #endif 47 47 48 - /* 49 - * "Conditional" syscalls 50 - * 51 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 52 - * but it doesn't work on all toolchains, so we just do it by hand 53 - */ 54 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 55 - 56 48 #endif /* _SPARC_UNISTD_H */
-8
arch/x86/include/asm/unistd.h
··· 50 50 # define __ARCH_WANT_SYS_VFORK 51 51 # define __ARCH_WANT_SYS_CLONE 52 52 53 - /* 54 - * "Conditional" syscalls 55 - * 56 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 57 - * but it doesn't work on all toolchains, so we just do it by hand 58 - */ 59 - # define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 60 - 61 53 #endif /* _ASM_X86_UNISTD_H */
-8
arch/xtensa/include/asm/unistd.h
··· 4 4 #define __ARCH_WANT_SYS_CLONE 5 5 #include <uapi/asm/unistd.h> 6 6 7 - /* 8 - * "Conditional" syscalls 9 - * 10 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 11 - * but it doesn't work on all toolchains, so we just do it by hand 12 - */ 13 - #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); 14 - 15 7 #define __ARCH_WANT_STAT64 16 8 #define __ARCH_WANT_SYS_UTIME 17 9 #define __ARCH_WANT_SYS_LLSEEK
-17
include/asm-generic/unistd.h
··· 9 9 #define __ARCH_WANT_STAT64 10 10 #define __ARCH_WANT_SYS_LLSEEK 11 11 #endif 12 - 13 - /* 14 - * "Conditional" syscalls 15 - * 16 - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 17 - * but it doesn't work on all toolchains, so we just do it by hand 18 - */ 19 - #ifndef cond_syscall 20 - #ifdef CONFIG_SYMBOL_PREFIX 21 - #define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX 22 - #else 23 - #define __SYMBOL_PREFIX 24 - #endif 25 - #define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \ 26 - ".set\t" __SYMBOL_PREFIX #x "," \ 27 - __SYMBOL_PREFIX "sys_ni_syscall") 28 - #endif
+21
include/linux/linkage.h
··· 2 2 #define _LINUX_LINKAGE_H 3 3 4 4 #include <linux/compiler.h> 5 + #include <linux/stringify.h> 5 6 #include <asm/linkage.h> 6 7 7 8 #ifdef __cplusplus ··· 13 12 14 13 #ifndef asmlinkage 15 14 #define asmlinkage CPP_ASMLINKAGE 15 + #endif 16 + 17 + #ifndef SYMBOL_NAME 18 + #ifdef CONFIG_SYMBOL_PREFIX 19 + #define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x 20 + #else 21 + #define SYMBOL_NAME(x) x 22 + #endif 23 + #endif 24 + #define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x)) 25 + 26 + #ifndef cond_syscall 27 + #define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \ 28 + "\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall)); 29 + #endif 30 + 31 + #ifndef SYSCALL_ALIAS 32 + #define SYSCALL_ALIAS(alias, name) \ 33 + asm ("\t.globl " __SYMBOL_NAME(alias) \ 34 + "\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name)) 16 35 #endif 17 36 18 37 #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
-14
include/linux/syscalls.h
··· 183 183 #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) 184 184 #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 185 185 186 - #ifdef CONFIG_PPC64 187 - #define SYSCALL_ALIAS(alias, name) \ 188 - asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ 189 - "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) 190 - #else 191 - #if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) 192 - #define SYSCALL_ALIAS(alias, name) \ 193 - asm ( #alias " = " #name "\n\t.globl " #alias) 194 - #else 195 - #define SYSCALL_ALIAS(alias, name) \ 196 - asm ("\t.globl " #alias "\n\t.set " #alias ", " #name) 197 - #endif 198 - #endif 199 - 200 186 #ifdef CONFIG_FTRACE_SYSCALLS 201 187 #define SYSCALL_DEFINEx(x, sname, ...) \ 202 188 static const char *types_##sname[] = { \