blob: 2a962929d7b37520c7b70a70b119eb3ac16aa58b [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 7406a50077773e78282a495cb32ef5b8179f6a33 Mon Sep 17 00:00:00 2001
2From: Dimitar Dimitrov <dimitar@dinux.eu>
3Date: Mon, 17 Dec 2018 21:30:52 +0200
4Subject: [PATCH] Fix build with latest GCC 9.0 tree
5
6A recent patch [1] to fix a GCC PR [2] actually broke the GDB build.
7To fix, remove the stack pointer clobber. GCC will ignore the clobber
8marker, and will not save or restore the stack pointer.
9
10I ran "make check-gdb" on x86_64 to ensure there are no regressions.
11
12gdb/ChangeLog:
13
142018-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
21Upstream-Status: Backport
22Signed-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
28diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
29index 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--
502.20.1