6ff5b88
commit 022f5af61bc3cbfa2b74ab355b0d2d30b3dab027
6ff5b88
Author: Khem Raj <raj.khem@gmail.com>
6ff5b88
Date:   Sat Dec 22 15:28:40 2018 -0800
6ff5b88
6ff5b88
    tests/amd64: Do not clobber %rsp register
6ff5b88
    
6ff5b88
    This is seen with gcc-9.0 compiler now which is fix that gcc community
6ff5b88
    did recently
6ff5b88
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813
6ff5b88
    
6ff5b88
    Signed-off-by: Khem Raj <raj.khem@gmail.com>
6ff5b88
6ff5b88
diff --git a/none/tests/amd64-linux/bug345887.c b/none/tests/amd64-linux/bug345887.c
6ff5b88
index 0f9237d..269bd70 100644
6ff5b88
--- a/none/tests/amd64-linux/bug345887.c
6ff5b88
+++ b/none/tests/amd64-linux/bug345887.c
6ff5b88
@@ -20,13 +20,17 @@ static void inner(void)
6ff5b88
       "movq $0x10d, %%r14\n"
6ff5b88
       "movq $0x10e, %%r15\n"
6ff5b88
       // not %rbp as mdb is then not able to reconstruct stack trace
6ff5b88
+      // Do change %rsp (to test a bogus stack pointer),
6ff5b88
+      // but don't add %rsp to the clobber list since gcc ignores it
6ff5b88
+      // and since gcc >= 9.0 errors about it
6ff5b88
+      // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813
6ff5b88
       "movq $0x10f, %%rsp\n"
6ff5b88
       "movq $0x1234, (%%rax)\n"  // should cause SEGV here
6ff5b88
       "ud2"                      // should never get here
6ff5b88
       : // no output registers
6ff5b88
       : // no input registers
6ff5b88
       : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
6ff5b88
-        "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "%rsp");
6ff5b88
+        "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15");
6ff5b88
 }
6ff5b88
 
6ff5b88
 __attribute__((noinline))
607b6fc
commit c512949082c4fc2285a82e102d4212c66e034a31
607b6fc
Author: Mark Wielaard <mark@klomp.org>
607b6fc
Date:   Fri Jan 11 20:00:17 2019 +0100
607b6fc
607b6fc
    Bug 402480 Do not use %esp in clobber list.
607b6fc
    
607b6fc
    This is the same fix as for amd64-linux, but now for x86-linux.
607b6fc
607b6fc
diff --git a/none/tests/x86-linux/bug345887.c b/none/tests/x86-linux/bug345887.c
607b6fc
index f2e8a8d..ef21d4e 100644
607b6fc
--- a/none/tests/x86-linux/bug345887.c
607b6fc
+++ b/none/tests/x86-linux/bug345887.c
607b6fc
@@ -12,12 +12,14 @@ static void inner(void)
607b6fc
       "movl $0x105, %%esi\n"
607b6fc
       "movl $0x106, %%edi\n"
607b6fc
       // not %ebp as mdb is then not able to reconstruct stack trace
607b6fc
+      // clobbering %esp is really bad, but that is kind of the point
607b6fc
+      // we don't add it to the clobber list since gcc9 warns about that
607b6fc
       "movl $0x108, %%esp\n"
607b6fc
       "movl $0x1234, (%%eax)\n"  // should cause SEGV here
607b6fc
       "ud2"                      // should never get here
607b6fc
       : // no output registers
607b6fc
       : // no input registers
607b6fc
-      : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%esp");
607b6fc
+      : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi");
607b6fc
 }
607b6fc
 
607b6fc
 __attribute__((noinline))