CVS commit: src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common
Module Name:src Committed By: kamil Date: Tue Apr 16 01:44:07 UTC 2019 Modified Files: src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common: sanitizer_linux.cc Log Message: Sync gcc.old GetPcSpBp() with GCC9 (and recent LLVM) Unify all NetBSD ports in a single ifdef. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc diff -u src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.7 src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.8 --- src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.7 Sun Nov 11 22:49:44 2018 +++ src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc Tue Apr 16 01:44:07 2019 @@ -1157,51 +1157,39 @@ void internal_join_thread(void *th) {} #endif void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { -#if defined(__arm__) - ucontext_t *ucontext = (ucontext_t*)context; -# if SANITIZER_NETBSD +#if SANITIZER_NETBSD + // This covers all NetBSD architectures + ucontext_t *ucontext = (ucontext_t *)context; *pc = _UC_MACHINE_PC(ucontext); + *bp = _UC_MACHINE_FP(ucontext); *sp = _UC_MACHINE_SP(ucontext); - *bp = ucontext->uc_mcontext.__gregs[_REG_R11]; -# else +#elif defined(__arm__) + ucontext_t *ucontext = (ucontext_t*)context; *pc = ucontext->uc_mcontext.arm_pc; *bp = ucontext->uc_mcontext.arm_fp; *sp = ucontext->uc_mcontext.arm_sp; -# endif #elif defined(__aarch64__) ucontext_t *ucontext = (ucontext_t*)context; -# if SANITIZER_NETBSD - *pc = _UC_MACHINE_PC(ucontext); - *sp = _UC_MACHINE_SP(ucontext); - *bp = ucontext->uc_mcontext.__gregs[29]; /* XXX */ -# else *pc = ucontext->uc_mcontext.pc; *bp = ucontext->uc_mcontext.regs[29]; *sp = ucontext->uc_mcontext.sp; -# endif #elif defined(__hppa__) ucontext_t *ucontext = (ucontext_t*)context; -# if SANITIZER_NETBSD - *pc = _UC_MACHINE_PC(ucontext); - *sp = _UC_MACHINE_SP(ucontext); - *bp = ucontext->uc_mcontext.__gregs[3]; /* XXX */ -#else *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]; -# endif #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]; +#elif SANITIZER_OPENBSD + sigcontext *ucontext = (sigcontext *)context; + *pc = ucontext->sc_rip; + *bp = ucontext->sc_rbp; + *sp = ucontext->sc_rsp; # else ucontext_t *ucontext = (ucontext_t*)context; *pc = ucontext->uc_mcontext.gregs[REG_RIP]; @@ -1214,89 +1202,73 @@ void GetPcSpBp(void *context, uptr *pc, *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; +#elif SANITIZER_OPENBSD + sigcontext *ucontext = (sigcontext *)context; + *pc = ucontext->sc_eip; + *bp = ucontext->sc_ebp; + *sp = ucontext->sc_esp; +# else + ucontext_t *ucontext = (ucontext_t*)context; +# if SANITIZER_SOLARIS + /* Use the numeric values: the symbolic ones are undefined by llvm + include/llvm/Support/Solaris.h. */ +# ifndef REG_EIP +# define REG_EIP 14 // REG_PC +# endif +# ifndef REG_EBP +# define REG_EBP 6 // REG_FP +# endif +# ifndef REG_ESP +# define REG_ESP 17 // REG_SP +# endif +# endif *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; -# if SANITIZER_NETBSD - *pc = _UC_MACHINE_PC(ucontext); - *sp = _UC_MACHINE_SP(ucontext); - *bp = ucontext->uc_mcontext.__gregs[_REG_R31]; -# else *pc = ucontext->uc_mcontext.regs->nip; *sp = ucontext->uc_mcontext.regs->gpr[PT_R1]; // 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]; -# endif #elif defined(__sparc__) +# if defined(__arch64__) ||
CVS commit: src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common
Module Name:src Committed By: kamil Date: Wed May 23 11:16:13 UTC 2018 Modified Files: src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common: sanitizer_linux.cc Log Message: Cherry-pick upstream patch for internal_mmap() in GCC(.old) sanitizers Fix internal_mmap() on 32-bit NetBSD platforms There is need to use internal_syscall64() instead of internal_syscall_ptr(). The offset argument of type off_t is always 64-bit. http://llvm.org/viewvc/llvm-project?view=revision=333075 PR kern/53261 by Martin Husemann To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc diff -u src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.4 src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.5 --- src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.4 Mon Nov 13 08:05:22 2017 +++ src/external/gpl3/gcc.old/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc Wed May 23 11:16:13 2018 @@ -103,7 +103,7 @@ namespace __sanitizer { uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd, u64 offset) { #if SANITIZER_NETBSD - return internal_syscall_ptr(SYSCALL(mmap), addr, length, prot, flags, fd, + return internal_syscall64(SYSCALL(mmap), addr, length, prot, flags, fd, (long)0, offset); #elif SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd,