Skip to content

Commit

Permalink
Fix for a gcc-9 compilation error that occurs if an inline asm
Browse files Browse the repository at this point in the history
statement clobbers the stack pointer.  Without the patch, x86 and
x86_64 builds will fail to compile gdb-7.6/gdb/common/linux-ptrace.c,
generating an error that indicates "error: Stack Pointer register
clobbered by '%rsp' in 'asm'".
([email protected])
  • Loading branch information
Dave Anderson committed Jan 8, 2019
1 parent 9154878 commit 8502f00
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gdb-7.6.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2428,3 +2428,22 @@ diff -up gdb-7.6/opcodes/configure.orig gdb-7.6/opcodes/configure
target_type = TYPE_MAIN_TYPE(type)->target_type;

if (target_type) {
--- gdb-7.6/gdb/common/linux-ptrace.c.orig
+++ gdb-7.6/gdb/common/linux-ptrace.c
@@ -108,14 +108,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

0 comments on commit 8502f00

Please sign in to comment.