public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, samitolvanen@google.com, alxmtvv@gmail.com,
	linux-kbuild@vger.kernel.org, yamada.masahiro@socionext.com,
	akpm@linux-foundation.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 06/21] x86/syscalls: Make x86 syscalls use real prototypes
Date: Mon, 27 Nov 2017 13:34:08 -0800	[thread overview]
Message-ID: <20171127213423.27218-7-andi@firstfloor.org> (raw)
In-Reply-To: <20171127213423.27218-1-andi@firstfloor.org>

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

LTO complains very loudly that the x86 syscalls use their own different
prototypes. Switch it to use the real prototypes instead. This requires
adding a few extra prototypes to asm/syscalls.h.

This is a generic cleanup, useful even without LTO.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/entry/syscall_32.c     | 13 +++++--------
 arch/x86/entry/syscall_64.c     | 13 +++++--------
 arch/x86/include/asm/syscalls.h | 42 ++++++++++++++++++++++++++++++++++++-----
 3 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
index 95c294963612..f7ffd4b100fd 100644
--- a/arch/x86/entry/syscall_32.c
+++ b/arch/x86/entry/syscall_32.c
@@ -6,20 +6,17 @@
 #include <linux/cache.h>
 #include <asm/asm-offsets.h>
 #include <asm/syscall.h>
+#include <linux/syscalls.h>
+#include <asm/syscalls.h>
+#include <asm/sys_ia32.h>
 
-#define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
-#include <asm/syscalls_32.h>
-#undef __SYSCALL_I386
-
-#define __SYSCALL_I386(nr, sym, qual) [nr] = sym,
-
-extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
+#define __SYSCALL_I386(nr, sym, qual) [nr] = (sys_call_ptr_t)sym,
 
 __visible const sys_call_ptr_t ia32_sys_call_table[__NR_syscall_compat_max+1] = {
 	/*
 	 * Smells like a compiler bug -- it doesn't work
 	 * when the & below is removed.
 	 */
-	[0 ... __NR_syscall_compat_max] = &sys_ni_syscall,
+	[0 ... __NR_syscall_compat_max] = (sys_call_ptr_t)&sys_ni_syscall,
 #include <asm/syscalls_32.h>
 };
diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c
index 9c09775e589d..1ccf4cd300a6 100644
--- a/arch/x86/entry/syscall_64.c
+++ b/arch/x86/entry/syscall_64.c
@@ -4,25 +4,22 @@
 #include <linux/linkage.h>
 #include <linux/sys.h>
 #include <linux/cache.h>
+#include <linux/syscalls.h>
+#include <linux/compat.h>
 #include <asm/asm-offsets.h>
 #include <asm/syscall.h>
+#include <asm/syscalls.h>
 
 #define __SYSCALL_64_QUAL_(sym) sym
 #define __SYSCALL_64_QUAL_ptregs(sym) ptregs_##sym
 
-#define __SYSCALL_64(nr, sym, qual) extern asmlinkage long __SYSCALL_64_QUAL_##qual(sym)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
-#include <asm/syscalls_64.h>
-#undef __SYSCALL_64
-
-#define __SYSCALL_64(nr, sym, qual) [nr] = __SYSCALL_64_QUAL_##qual(sym),
-
-extern long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
+#define __SYSCALL_64(nr, sym, qual) [nr] = (sys_call_ptr_t)__SYSCALL_64_QUAL_##qual(sym),
 
 asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
 	/*
 	 * Smells like a compiler bug -- it doesn't work
 	 * when the & below is removed.
 	 */
-	[0 ... __NR_syscall_max] = &sys_ni_syscall,
+	[0 ... __NR_syscall_max] = (sys_call_ptr_t)&sys_ni_syscall,
 #include <asm/syscalls_64.h>
 };
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index bad25bb80679..76bf99c8b151 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -14,6 +14,7 @@
 #include <linux/linkage.h>
 #include <linux/signal.h>
 #include <linux/types.h>
+#include <linux/compat.h>
 
 /* Common in X86_32 and X86_64 */
 /* kernel/ioport.c */
@@ -30,6 +31,8 @@ asmlinkage long sys_rt_sigreturn(void);
 asmlinkage long sys_set_thread_area(struct user_desc __user *);
 asmlinkage long sys_get_thread_area(struct user_desc __user *);
 
+asmlinkage long sys_arch_prctl(int, unsigned long);
+
 /* X86_32 only */
 #ifdef CONFIG_X86_32
 
@@ -43,13 +46,42 @@ asmlinkage long sys_vm86(unsigned long, unsigned long);
 
 #else /* CONFIG_X86_32 */
 
-/* X86_64 only */
-/* kernel/process_64.c */
-asmlinkage long sys_arch_prctl(int, unsigned long);
-
 /* kernel/sys_x86_64.c */
 asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long,
 			 unsigned long, unsigned long, unsigned long);
 
-#endif /* CONFIG_X86_32 */
+asmlinkage long ptregs_sys_rt_sigreturn(struct pt_regs *regs);
+asmlinkage long ptregs_sys_fork(struct pt_regs *regs);
+asmlinkage long ptregs_sys_vfork(struct pt_regs *regs);
+asmlinkage long ptregs_sys_execve(const char __user *filename,
+		const char __user *const __user *argv,
+		const char __user *const __user *envp);
+asmlinkage long ptregs_sys_iopl(unsigned int);
+asmlinkage long ptregs_sys_execveat(int dfd, const char __user *filename,
+			const char __user *const __user *argv,
+			const char __user *const __user *envp, int flags);
+asmlinkage long ptregs_sys_clone(unsigned long, unsigned long, int __user *,
+	       int __user *, unsigned long);
+
+#ifdef CONFIG_COMPAT
+asmlinkage long compat_sys_preadv64v2(unsigned long fd,
+	       const struct compat_iovec __user *vec,
+	       unsigned long vlen, loff_t pos, int flags);
+asmlinkage long ptregs_compat_sys_execve(unsigned long dfd,
+		 const char __user *filename,
+		 const compat_uptr_t __user *argv,
+		 const compat_uptr_t __user *envp);
+asmlinkage long ptregs_compat_sys_execveat(int dfd, const char __user *filename,
+		     const compat_uptr_t __user *argv,
+		     const compat_uptr_t __user *envp, int flags);
+asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
+	struct compat_rlimit __user *rlim);
+asmlinkage long stub32_clone(unsigned, unsigned, int __user *,
+	       compat_uptr_t __user *, unsigned);
+#endif
+
+asmlinkage long sys32_x32_rt_sigreturn(void);
+
+
+#endif /* !CONFIG_X86_32 */
 #endif /* _ASM_X86_SYSCALLS_H */
-- 
2.13.6


  parent reply	other threads:[~2017-11-27 21:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 21:34 Link time optimization for LTO/x86 Andi Kleen
2017-11-27 21:34 ` [PATCH 01/21] x86/xen: Mark pv stub assembler symbol visible Andi Kleen
2017-11-27 21:34 ` [PATCH 02/21] afs: Fix const confusion in AFS Andi Kleen
2017-11-28 16:04   ` David Howells
2017-11-28 16:50     ` Andi Kleen
2017-11-27 21:34 ` [PATCH 03/21] x86/timer: Don't inline __const_udelay Andi Kleen
2017-11-27 21:34 ` [PATCH 04/21] locking/spinlocks: Mark spinlocks noinline when inline spinlocks are disabled Andi Kleen
2017-11-27 21:34 ` [PATCH 05/21] x86/kvm: Make steal_time visible Andi Kleen
2017-11-27 21:34 ` Andi Kleen [this message]
2017-11-27 21:34 ` [PATCH 07/21] x86: Make exception handler functions visible Andi Kleen
2017-11-27 21:34 ` [PATCH 08/21] x86/idt: Make const __initconst Andi Kleen
2017-11-27 21:34 ` [PATCH 09/21] lto: Use C version for SYSCALL_ALIAS Andi Kleen
2017-11-27 21:34 ` [PATCH 10/21] Fix read buffer overflow in delta-ipc Andi Kleen
2017-11-27 21:34 ` [PATCH 11/21] trace: Use -mcount-record for dynamic ftrace Andi Kleen
2017-12-01  0:22   ` Steven Rostedt
2018-05-01 18:42     ` Steven Rostedt
2017-11-27 21:34 ` [PATCH 12/21] ftrace: Mark function tracer test functions noinline/noclone Andi Kleen
2017-11-27 21:34 ` [PATCH 13/21] ftrace: Disable LTO for ftrace self tests Andi Kleen
2017-11-27 21:34 ` [PATCH 14/21] lto, fs: Avoid static variable in linux/fs.h Andi Kleen
2017-11-27 21:34 ` [PATCH 15/21] lto, x86, mm: Disable vmalloc BUILD_BUG_ON for LTO Andi Kleen
2017-11-27 21:34 ` [PATCH 16/21] lto: Add __noreorder and mark initcalls __noreorder Andi Kleen
2017-11-27 21:34 ` [PATCH 17/21] lto, workaround: Disable LTO for BPF Andi Kleen
2017-11-27 21:34 ` [PATCH 18/21] lto, crypto: Disable LTO for camelia glue Andi Kleen
2017-11-27 21:34 ` [PATCH 19/21] lto, x86: Disable LTO for realmode / vDSO / head64 Andi Kleen
2017-11-27 21:34 ` [PATCH 20/21] Kbuild, lto: Add Link Time Optimization support Andi Kleen
2018-01-27  0:15   ` Arnd Bergmann
2018-01-27  0:55     ` Andi Kleen
2018-01-27 14:26       ` Arnd Bergmann
2018-01-28 18:33         ` Andi Kleen
2017-11-27 21:34 ` [PATCH 21/21] x86: Enable Link Time Optimization Andi Kleen
2017-11-29 23:09 ` Link time optimization for LTO/x86 Sami Tolvanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171127213423.27218-7-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alxmtvv@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox