[asan] fix the non-x86 build

llvm-svn: 259745
This commit is contained in:
Kostya Serebryany 2016-02-04 02:33:48 +00:00
parent f8abe8c825
commit 0e05d6eb9c
2 changed files with 5 additions and 0 deletions

View File

@ -1156,8 +1156,12 @@ void internal_join_thread(void *th) {}
#endif #endif
bool GetSigContextWriteFlag(void *context) { bool GetSigContextWriteFlag(void *context) {
#if defined(__x86_64__) || defined(__i386__)
ucontext_t *ucontext = (ucontext_t*)context; ucontext_t *ucontext = (ucontext_t*)context;
return ucontext->uc_mcontext.gregs[REG_ERR] & 2; return ucontext->uc_mcontext.gregs[REG_ERR] & 2;
#else
return false; // FIXME: Implement.
#endif
} }
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {

View File

@ -1,6 +1,7 @@
// RUN: %clangxx_asan -O0 %s -o %t // RUN: %clangxx_asan -O0 %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=READ // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=READ
// RUN: not %run %t write 2>&1 | FileCheck %s --check-prefix=WRITE // RUN: not %run %t write 2>&1 | FileCheck %s --check-prefix=WRITE
// REQUIRES: x86_64-supported-target
static volatile int sink; static volatile int sink;
__attribute__((noinline)) void Read(int *ptr) { sink = *ptr; } __attribute__((noinline)) void Read(int *ptr) { sink = *ptr; }