Message ID | 20181217193052.24157-1-dimitar@dinux.eu |
---|---|
State | New, archived |
Headers |
Received: (qmail 35952 invoked by alias); 17 Dec 2018 19:31:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 35940 invoked by uid 89); 17 Dec 2018 19:31:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*eu, H*RU:sk:server2, H*r:sk:server2, Hx-spam-relays-external:sk:server2 X-HELO: server28.superhosting.bg Received: from server28.superhosting.bg (HELO server28.superhosting.bg) (217.174.156.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Dec 2018 19:31:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tGy6dv8TjfNtEy+AUZkEOTr3Aa7ceB7umriSW9T4YPc=; b=pIhrGFWl3biNZAX2AYQXI35ZOe yBzPqQTXsI8AjoR2zgauq8xJcvvUVJ4FaQcAIiCVyxlf5KG5GzslMKyvdUBd+NPGOco99cKLc9uoS LhsQiponeYh+ezS51On99ySjzx7jv6XRStxB/a0kKwL9HQLWHVpintjRwWh0GjlFBwZUsBeq1Icew uwAjsAp6vHAnpHpkvEZjZ9p1H6+WYvapWEz4oNCwuRE8ln4pyBG8f4b29T40MHm+BF1FSmFzQYIIp gTxIeQJ7ojh9MCqc4hPg5wud0Epj2x8ABcqBkt9v+5iBSo+Fgm/6QQ7UVSYpCri9AfCVLk3If2iKM cMdr6g9w==; Received: from [95.87.234.74] (port=39258 helo=localhost.localdomain) by server28.superhosting.bg with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from <dimitar@dinux.eu>) id 1gYybl-0007uX-GM; Mon, 17 Dec 2018 21:31:19 +0200 From: Dimitar Dimitrov <dimitar@dinux.eu> To: gdb-patches@sourceware.org Cc: Dimitar Dimitrov <dimitar@dinux.eu> Subject: [PATCH] Fix build with latest GCC 9.0 tree Date: Mon, 17 Dec 2018 21:30:52 +0200 Message-Id: <20181217193052.24157-1-dimitar@dinux.eu> X-OutGoing-Spam-Status: No, score=-1.0 X-IsSubscribed: yes |
Commit Message
Dimitar Dimitrov
Dec. 17, 2018, 7:30 p.m. UTC
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/nat/linux-ptrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 2018-12-17 14:30, Dimitar Dimitrov wrote: > 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/nat/linux-ptrace.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c > index 1f21ef03a3..58aed199bf 100644 > --- a/gdb/nat/linux-ptrace.c > +++ b/gdb/nat/linux-ptrace.c > @@ -128,14 +128,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 LGTM: 1. We push a return address and ret, so in the end the stack point has not changed. 2. This is executed in a child process, which immediately stops on a breakpoint and never continues, even if the stack pointer was messed up, we wouldn't notice. Do you have push access, or would you like me to push the patch for you? Simon
On понеделник, 17 декември 2018 г. 22:05:11 EET Simon Marchi wrote: > On 2018-12-17 14:30, Dimitar Dimitrov wrote: > > 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/nat/linux-ptrace.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c > > index 1f21ef03a3..58aed199bf 100644 > > --- a/gdb/nat/linux-ptrace.c > > +++ b/gdb/nat/linux-ptrace.c > > @@ -128,14 +128,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 > > LGTM: > > 1. We push a return address and ret, so in the end the stack point has > not changed. > 2. This is executed in a child process, which immediately stops on a > breakpoint and never continues, even if the stack pointer was messed up, > we wouldn't notice. > > Do you have push access, or would you like me to push the patch for you? I do not have push access for GDB. Please push it for me. Please note that discussion on GCC mailing list is still ongoing. I still think that this GDB patch should be merged, though. https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01250.html https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01308.html Thanks, Dimitar
On 2018-12-19 01:13, Dimitar Dimitrov wrote: > I do not have push access for GDB. Please push it for me. > > Please note that discussion on GCC mailing list is still ongoing. I > still > think that this GDB patch should be merged, though. > > https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01250.html > https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01308.html Thanks, I pushed it. Simon
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c index 1f21ef03a3..58aed199bf 100644 --- a/gdb/nat/linux-ptrace.c +++ b/gdb/nat/linux-ptrace.c @@ -128,14 +128,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