Skip to content

Commit

Permalink
consolidate cond_syscall and SYSCALL_ALIAS declarations
Browse files Browse the repository at this point in the history
take them to asm/linkage.h, with default in linux/linkage.h

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 4, 2013
1 parent 4a0fd5b commit e1b5bb6
Show file tree
Hide file tree
Showing 29 changed files with 44 additions and 209 deletions.
4 changes: 3 additions & 1 deletion arch/alpha/include/asm/linkage.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H

/* Nothing to see here... */
#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
#define SYSCALL_ALIAS(alias, name) \
asm ( #alias " = " #name "\n\t.globl " #alias)

#endif
12 changes: 0 additions & 12 deletions arch/alpha/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/* "Conditional" syscalls. What we want is
__attribute__((weak,alias("sys_ni_syscall")))
but that raises the problem of what type to give the symbol. If we use
a prototype, it'll conflict with the definition given in this file and
others. If we use __typeof, we discover that not all symbols actually
have declarations. If we use no prototype, then we get warnings from
-Wstrict-prototypes. Ho hum. */

#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")

#endif /* _ALPHA_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/arm/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

/*
* Unimplemented (or alternatively implemented) syscalls
*/
Expand Down
8 changes: 0 additions & 8 deletions arch/avr32/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");

#endif /* __ASM_AVR32_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/blackfin/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,4 @@
#define __ARCH_WANT_SYS_NICE
#define __ARCH_WANT_SYS_VFORK

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall");

#endif /* __ASM_BFIN_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/cris/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_CRIS_UNISTD_H_ */
10 changes: 0 additions & 10 deletions arch/frv/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#ifndef cond_syscall
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
#endif

#endif /* _ASM_UNISTD_H_ */
2 changes: 0 additions & 2 deletions arch/h8300/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
#define _H8300_LINKAGE_H

#undef SYMBOL_NAME_LABEL
#undef SYMBOL_NAME
#define SYMBOL_NAME_LABEL(_name_) _##_name_##:
#define SYMBOL_NAME(_name_) _##_name_
#endif
7 changes: 0 additions & 7 deletions arch/h8300/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*/
#define cond_syscall(name) \
asm (".weak\t_" #name "\n" \
".set\t_" #name ",_sys_ni_syscall");

#endif /* _ASM_H8300_UNISTD_H_ */
4 changes: 4 additions & 0 deletions arch/ia64/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@

#endif

#define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#")
#define SYSCALL_ALIAS(alias, name) \
asm ( #alias "# = " #name "#\n\t.globl " #alias "#")

#endif
10 changes: 0 additions & 10 deletions arch/ia64/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,5 @@ asmlinkage unsigned long sys_mmap2(
struct pt_regs;
asmlinkage long sys_ia64_pipe(void);

/*
* "Conditional" syscalls
*
* Note, this macro can only be used in the file which defines sys_ni_syscall, i.e., in
* kernel/sys_ni.c. This version causes warnings because the declaration isn't a
* proper prototype, but we can't use __typeof__ either, because not all cond_syscall()
* declarations have prototypes at the moment.
*/
#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))

#endif /* !__ASSEMBLY__ */
#endif /* _ASM_IA64_UNISTD_H */
10 changes: 0 additions & 10 deletions arch/m32r/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,4 @@
#define __IGNORE_getresgid
#define __IGNORE_chown

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#ifndef cond_syscall
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
#endif

#endif /* _ASM_M32R_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/m68k/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,4 @@
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_M68K_UNISTD_H_ */
8 changes: 0 additions & 8 deletions arch/microblaze/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,5 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_FORK

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");

#endif /* __ASSEMBLY__ */
#endif /* _ASM_MICROBLAZE_UNISTD_H */
3 changes: 3 additions & 0 deletions arch/mips/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
#endif

#define __weak __attribute__((weak))
#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
#define SYSCALL_ALIAS(alias, name) \
asm ( #alias " = " #name "\n\t.globl " #alias)

#endif
8 changes: 0 additions & 8 deletions arch/mips/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,4 @@

#endif /* !__ASSEMBLY__ */

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")

#endif /* _ASM_UNISTD_H */
10 changes: 0 additions & 10 deletions arch/mn10300/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#ifndef cond_syscall
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
#endif

#endif /* _ASM_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/parisc/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,4 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \

#undef STR

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_PARISC_UNISTD_H_ */
13 changes: 13 additions & 0 deletions arch/powerpc/include/asm/linkage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _ASM_POWERPC_LINKAGE_H
#define _ASM_POWERPC_LINKAGE_H

#ifdef CONFIG_PPC64
#define cond_syscall(x) \
asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \
"\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
#define SYSCALL_ALIAS(alias, name) \
asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
"\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
#endif

#endif /* _ASM_POWERPC_LINKAGE_H */
6 changes: 0 additions & 6 deletions arch/powerpc/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,5 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*/
#define cond_syscall(x) \
asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))

#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_UNISTD_H_ */
6 changes: 0 additions & 6 deletions arch/powerpc/include/uapi/asm/linkage.h

This file was deleted.

8 changes: 0 additions & 8 deletions arch/s390/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_S390_UNISTD_H_ */
8 changes: 0 additions & 8 deletions arch/sh/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,4 @@
# define __ARCH_WANT_SYS_VFORK
# define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#include <uapi/asm/unistd.h>
8 changes: 0 additions & 8 deletions arch/sparc/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,4 @@
#define __ARCH_WANT_COMPAT_SYS_SENDFILE
#endif

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _SPARC_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/x86/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,4 @@
# define __ARCH_WANT_SYS_VFORK
# define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_X86_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/xtensa/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
#define __ARCH_WANT_SYS_CLONE
#include <uapi/asm/unistd.h>

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");

#define __ARCH_WANT_STAT64
#define __ARCH_WANT_SYS_UTIME
#define __ARCH_WANT_SYS_LLSEEK
Expand Down
17 changes: 0 additions & 17 deletions include/asm-generic/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,3 @@
#define __ARCH_WANT_STAT64
#define __ARCH_WANT_SYS_LLSEEK
#endif

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#ifndef cond_syscall
#ifdef CONFIG_SYMBOL_PREFIX
#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
#else
#define __SYMBOL_PREFIX
#endif
#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \
".set\t" __SYMBOL_PREFIX #x "," \
__SYMBOL_PREFIX "sys_ni_syscall")
#endif
21 changes: 21 additions & 0 deletions include/linux/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _LINUX_LINKAGE_H

#include <linux/compiler.h>
#include <linux/stringify.h>
#include <asm/linkage.h>

#ifdef __cplusplus
Expand All @@ -14,6 +15,26 @@
#define asmlinkage CPP_ASMLINKAGE
#endif

#ifndef SYMBOL_NAME
#ifdef CONFIG_SYMBOL_PREFIX
#define SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX ## x
#else
#define SYMBOL_NAME(x) x
#endif
#endif
#define __SYMBOL_NAME(x) __stringify(SYMBOL_NAME(x))

#ifndef cond_syscall
#define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \
"\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall));
#endif

#ifndef SYSCALL_ALIAS
#define SYSCALL_ALIAS(alias, name) \
asm ("\t.globl " __SYMBOL_NAME(alias) \
"\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name))
#endif

#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
#define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE)

Expand Down
Loading

0 comments on commit e1b5bb6

Please sign in to comment.