Blame SOURCES/valgrind-3.14.0-rsp-clobber.patch

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