Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | From 7406a50077773e78282a495cb32ef5b8179f6a33 Mon Sep 17 00:00:00 2001 |
| 2 | From: Dimitar Dimitrov <dimitar@dinux.eu> |
| 3 | Date: Mon, 17 Dec 2018 21:30:52 +0200 |
| 4 | Subject: [PATCH] Fix build with latest GCC 9.0 tree |
| 5 | |
| 6 | A recent patch [1] to fix a GCC PR [2] actually broke the GDB build. |
| 7 | To fix, remove the stack pointer clobber. GCC will ignore the clobber |
| 8 | marker, and will not save or restore the stack pointer. |
| 9 | |
| 10 | I ran "make check-gdb" on x86_64 to ensure there are no regressions. |
| 11 | |
| 12 | gdb/ChangeLog: |
| 13 | |
| 14 | 2018-12-17 Dimitar Dimitrov <dimitar@dinux.eu> |
| 15 | |
| 16 | * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Remove sp clobbers. |
| 17 | |
| 18 | [1] https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00532.html |
| 19 | [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 |
| 20 | |
| 21 | Upstream-Status: Backport |
| 22 | Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu> |
| 23 | --- |
| 24 | gdb/ChangeLog | 5 +++++ |
| 25 | gdb/nat/linux-ptrace.c | 4 ++-- |
| 26 | 2 files changed, 7 insertions(+), 2 deletions(-) |
| 27 | |
| 28 | diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c |
| 29 | index d4c1b8f9fd..187cfeb9bc 100644 |
| 30 | --- a/gdb/nat/linux-ptrace.c |
| 31 | +++ b/gdb/nat/linux-ptrace.c |
| 32 | @@ -161,14 +161,14 @@ linux_ptrace_test_ret_to_nx (void) |
| 33 | ".globl linux_ptrace_test_ret_to_nx_instr;" |
| 34 | "linux_ptrace_test_ret_to_nx_instr:" |
| 35 | "ret" |
| 36 | - : : "r" (return_address) : "%esp", "memory"); |
| 37 | + : : "r" (return_address) : "memory"); |
| 38 | #elif defined __x86_64__ |
| 39 | asm volatile ("pushq %0;" |
| 40 | ".globl linux_ptrace_test_ret_to_nx_instr;" |
| 41 | "linux_ptrace_test_ret_to_nx_instr:" |
| 42 | "ret" |
| 43 | : : "r" ((uint64_t) (uintptr_t) return_address) |
| 44 | - : "%rsp", "memory"); |
| 45 | + : "memory"); |
| 46 | #else |
| 47 | # error "!__i386__ && !__x86_64__" |
| 48 | #endif |
| 49 | -- |
| 50 | 2.20.1 |