2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-04 08:15:37 +00:00

Fix gcc9 build failures

I received this patch from Jeff Law as a fix for build failures with the
upcoming GCC 9. The following is Jeff Law's description of the patch:

 Attached you'll find the fix for criu.  You'll see it's just a matter
 of dropping the sp/esp clobber from the relevant asm statements.  THe
 details:

 criu has a macro which defines an asm which appears to want to set a new
 stack pointer, then directly issue a sigreturn call to the kernel.  Some
 variants clobber sp (aarch64, arm, x86), others do not (ppc, s390)

 While the asm does indeed set a new stack pointer, we never return from
 a sigreturn syscall -- at least not in the normal way.  We actually
 return back to the point where the process was interrupted by the
 signal.  So describing the affect of the asm on the stack pointer is
 pedantically correct, it actually has no real effect and can just be
 dropped to avoid the hard error from gcc-9.

Suggested-by: Jeff Law <law@redhat.com>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
Jeff Law
2019-01-09 12:49:11 +00:00
committed by Andrei Vagin
parent 7fd39f96ae
commit 901f5d48ec
3 changed files with 4 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ struct rt_sigframe {
"svc #0 \n" \
: \
: "r"(new_sp) \
: "sp", "x8", "memory")
: "x8", "memory")
/* cr_sigcontext is copied from arch/arm64/include/uapi/asm/sigcontext.h */
struct cr_sigcontext {

View File

@@ -73,7 +73,7 @@ struct rt_sigframe {
"svc #0 \n" \
: \
: "r"(new_sp) \
: "sp","memory")
: "memory")
#define RT_SIGFRAME_UC(rt_sigframe) (&rt_sigframe->sig.uc)
#define RT_SIGFRAME_REGIP(rt_sigframe) (rt_sigframe)->sig.uc.uc_mcontext.arm_ip

View File

@@ -162,7 +162,7 @@ struct rt_sigframe {
"syscall \n" \
: \
: "r"(new_sp) \
: "rax","rsp","memory")
: "rax","memory")
#define ARCH_RT_SIGRETURN_COMPAT(new_sp) \
asm volatile( \
"pushq $"__stringify(USER32_CS)" \n" \
@@ -176,7 +176,7 @@ struct rt_sigframe {
".code64 \n" \
: \
: "rdi"(new_sp) \
: "eax","esp", "r8", "r9", "r10", "r11", "memory")
: "eax", "r8", "r9", "r10", "r11", "memory")
#define ARCH_RT_SIGRETURN(new_sp, rt_sigframe) \
do { \