Commit e1b5bb6d1236d4ad2084c53aa83dde7cdf6f8eea

Authored by Al Viro
1 parent 4a0fd5bf0f

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>

Showing 29 changed files with 44 additions and 209 deletions Side-by-side Diff

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
arch/alpha/include/asm/unistd.h
... ... @@ -18,17 +18,5 @@
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 */
arch/arm/include/asm/unistd.h
... ... @@ -44,14 +44,6 @@
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
arch/avr32/include/asm/unistd.h
... ... @@ -41,13 +41,5 @@
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 */
arch/blackfin/include/asm/unistd.h
... ... @@ -20,13 +20,5 @@
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 */
arch/cris/include/asm/unistd.h
... ... @@ -34,13 +34,5 @@
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_ */
arch/frv/include/asm/unistd.h
... ... @@ -31,15 +31,5 @@
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_ */
arch/h8300/include/asm/linkage.h
... ... @@ -2,8 +2,6 @@
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
arch/h8300/include/asm/unistd.h
... ... @@ -33,12 +33,5 @@
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_ */
arch/ia64/include/asm/linkage.h
... ... @@ -11,5 +11,9 @@
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
arch/ia64/include/asm/unistd.h
... ... @@ -46,16 +46,6 @@
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 */
arch/m32r/include/asm/unistd.h
... ... @@ -48,15 +48,5 @@
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 */
arch/m68k/include/asm/unistd.h
... ... @@ -32,13 +32,5 @@
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_ */
arch/microblaze/include/asm/unistd.h
... ... @@ -37,14 +37,6 @@
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 */
arch/mips/include/asm/linkage.h
... ... @@ -6,6 +6,9 @@
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
arch/mips/include/asm/unistd.h
... ... @@ -63,13 +63,5 @@
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 */
arch/mn10300/include/asm/unistd.h
... ... @@ -45,15 +45,5 @@
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 */
arch/parisc/include/asm/unistd.h
... ... @@ -170,13 +170,5 @@
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_ */
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 */
arch/powerpc/include/asm/unistd.h
... ... @@ -56,12 +56,6 @@
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_ */
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 */
arch/s390/include/asm/unistd.h
... ... @@ -54,13 +54,5 @@
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_ */
arch/sh/include/asm/unistd.h
... ... @@ -30,13 +30,5 @@
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>
arch/sparc/include/asm/unistd.h
... ... @@ -45,13 +45,5 @@
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 */
arch/x86/include/asm/unistd.h
... ... @@ -50,13 +50,5 @@
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 */
arch/xtensa/include/asm/unistd.h
... ... @@ -4,14 +4,6 @@
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
include/asm-generic/unistd.h
... ... @@ -9,21 +9,4 @@
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
include/linux/linkage.h
... ... @@ -2,6 +2,7 @@
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
... ... @@ -12,6 +13,26 @@
12 13  
13 14 #ifndef asmlinkage
14 15 #define asmlinkage CPP_ASMLINKAGE
  16 +#endif
  17 +
  18 +#ifndef SYMBOL_NAME
  19 +#ifdef CONFIG_SYMBOL_PREFIX
  20 +#define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x
  21 +#else
  22 +#define SYMBOL_NAME(x) x
  23 +#endif
  24 +#endif
  25 +#define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x))
  26 +
  27 +#ifndef cond_syscall
  28 +#define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \
  29 + "\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall));
  30 +#endif
  31 +
  32 +#ifndef SYSCALL_ALIAS
  33 +#define SYSCALL_ALIAS(alias, name) \
  34 + asm ("\t.globl " __SYMBOL_NAME(alias) \
  35 + "\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name))
15 36 #endif
16 37  
17 38 #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
include/linux/syscalls.h
... ... @@ -183,20 +183,6 @@
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[] = { \