Fix build with latest GCC 9.0 tree
authorDimitar Dimitrov <dimitar@dinux.eu>
Mon, 17 Dec 2018 19:30:52 +0000 (21:30 +0200)
committerSimon Marchi <simon.marchi@ericsson.com>
Wed, 19 Dec 2018 15:44:23 +0000 (10:44 -0500)
A recent patch [1] to fix a GCC PR [2] actually broke the GDB build.
To fix, remove the stack pointer clobber. GCC will ignore the clobber
marker, and will not save or restore the stack pointer.

I ran "make check-gdb" on x86_64 to ensure there are no regressions.

gdb/ChangeLog:

2018-12-17  Dimitar Dimitrov  <dimitar@dinux.eu>

* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Remove sp clobbers.

[1] https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00532.html
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
gdb/ChangeLog
gdb/nat/linux-ptrace.c

index 08c7c6c1f48079f98a63790fd8730eba0c920885..4283cbb6b17d09ebb48b8921ced19ca5115c60e2 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-19  Dimitar Dimitrov  <dimitar@dinux.eu>
+
+       * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Remove
+       sp clobbers.
+
 2018-12-17  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * dwarf2read.c (struct dwarf2_cu): Convert the fields 'mark',
index d4c1b8f9fdcab1d5fa378ffaeeb57e10884612f1..187cfeb9bc16aa51fa182a12dc3541317bc2f2a6 100644 (file)
@@ -161,14 +161,14 @@ linux_ptrace_test_ret_to_nx (void)
                        ".globl linux_ptrace_test_ret_to_nx_instr;"
                        "linux_ptrace_test_ret_to_nx_instr:"
                        "ret"
-                       : : "r" (return_address) : "%esp", "memory");
+                       : : "r" (return_address) : "memory");
 #elif defined __x86_64__
          asm volatile ("pushq %0;"
                        ".globl linux_ptrace_test_ret_to_nx_instr;"
                        "linux_ptrace_test_ret_to_nx_instr:"
                        "ret"
                        : : "r" ((uint64_t) (uintptr_t) return_address)
-                       : "%rsp", "memory");
+                       : "memory");
 #else
 # error "!__i386__ && !__x86_64__"
 #endif