blob: 8a662a2685993d02912c84445b7a7e8a15107fe2 (
plain) (
tree)
|
|
--- gcc-8.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cc.old 2017-10-19 11:23:59.000000000 +0000
+++ gcc-8.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cc 2019-06-27 05:39:48.258332316 +0000
@@ -752,7 +752,9 @@
}
#if SANITIZER_LINUX
+#ifndef SA_RESTORER
#define SA_RESTORER 0x04000000
+#endif
// Doesn't set sa_restorer if the caller did not set it, so use with caution
//(see below).
int internal_sigaction_norestorer(int signum, const void *act, void *oldact) {
@@ -1687,65 +1689,59 @@
}
static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
-#if defined(__arm__)
ucontext_t *ucontext = (ucontext_t*)context;
+#if defined(__arm__)
*pc = ucontext->uc_mcontext.arm_pc;
*bp = ucontext->uc_mcontext.arm_fp;
*sp = ucontext->uc_mcontext.arm_sp;
#elif defined(__aarch64__)
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.pc;
*bp = ucontext->uc_mcontext.regs[29];
*sp = ucontext->uc_mcontext.sp;
#elif defined(__hppa__)
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.sc_iaoq[0];
/* GCC uses %r3 whenever a frame pointer is needed. */
*bp = ucontext->uc_mcontext.sc_gr[3];
*sp = ucontext->uc_mcontext.sc_gr[30];
#elif defined(__x86_64__)
# if SANITIZER_FREEBSD
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.mc_rip;
*bp = ucontext->uc_mcontext.mc_rbp;
*sp = ucontext->uc_mcontext.mc_rsp;
#elif SANITIZER_NETBSD
- ucontext_t *ucontext = (ucontext_t *)context;
*pc = ucontext->uc_mcontext.__gregs[_REG_RIP];
*bp = ucontext->uc_mcontext.__gregs[_REG_RBP];
*sp = ucontext->uc_mcontext.__gregs[_REG_RSP];
# else
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.gregs[REG_RIP];
*bp = ucontext->uc_mcontext.gregs[REG_RBP];
*sp = ucontext->uc_mcontext.gregs[REG_RSP];
# endif
#elif defined(__i386__)
# if SANITIZER_FREEBSD
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.mc_eip;
*bp = ucontext->uc_mcontext.mc_ebp;
*sp = ucontext->uc_mcontext.mc_esp;
#elif SANITIZER_NETBSD
- ucontext_t *ucontext = (ucontext_t *)context;
*pc = ucontext->uc_mcontext.__gregs[_REG_EIP];
*bp = ucontext->uc_mcontext.__gregs[_REG_EBP];
*sp = ucontext->uc_mcontext.__gregs[_REG_ESP];
# else
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.gregs[REG_EIP];
*bp = ucontext->uc_mcontext.gregs[REG_EBP];
*sp = ucontext->uc_mcontext.gregs[REG_ESP];
# endif
-#elif defined(__powerpc__) || defined(__powerpc64__)
- ucontext_t *ucontext = (ucontext_t*)context;
- *pc = ucontext->uc_mcontext.regs->nip;
- *sp = ucontext->uc_mcontext.regs->gpr[PT_R1];
+#elif defined(__powerpc64__)
+ *pc = ucontext->uc_mcontext.gp_regs[32];
+ *sp = ucontext->uc_mcontext.gp_regs[1];
+ *bp = ucontext->uc_mcontext.gp_regs[31];
+#elif defined(__powerpc__)
+ *pc = ucontext->uc_mcontext.gregs[32];
+ *sp = ucontext->uc_mcontext.gregs[1];
// The powerpc{,64}-linux ABIs do not specify r31 as the frame
// pointer, but GCC always uses r31 when we need a frame pointer.
- *bp = ucontext->uc_mcontext.regs->gpr[PT_R31];
+ *bp = ucontext->uc_mcontext.gregs[31];
#elif defined(__sparc__)
- ucontext_t *ucontext = (ucontext_t*)context;
uptr *stk_ptr;
# if defined (__arch64__)
*pc = ucontext->uc_mcontext.mc_gregs[MC_PC];
@@ -1759,12 +1755,10 @@
*bp = stk_ptr[15];
# endif
#elif defined(__mips__)
- ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.pc;
*bp = ucontext->uc_mcontext.gregs[30];
*sp = ucontext->uc_mcontext.gregs[29];
#elif defined(__s390__)
- ucontext_t *ucontext = (ucontext_t*)context;
# if defined(__s390x__)
*pc = ucontext->uc_mcontext.psw.addr;
# else
|