On Fri, 2014-05-23 at 09:25 -0500, Peter Bergner wrote: > xagsmtp4.20140523142452.1...@vmsdvm6.vnet.ibm.com > X-Xagent-Gateway: vmsdvm6.vnet.ibm.com (XAGSMTP4 at VMSDVM6) > > On Fri, 2014-05-23 at 17:45 +0400, Konstantin Serebryany wrote: > > On Fri, May 23, 2014 at 5:41 PM, Marek Polacek <pola...@redhat.com> wrote: > > > On Mon, May 12, 2014 at 03:20:37PM +0400, Konstantin Serebryany wrote: > > >> 5 months' worth of changes may break any platform we are not testing > > >> ourselves > > >> (that includes Ubuntu 12.04, 13.10, 14.04, Mac 10.9, Windows 7, Android > > >> ARM), > > >> please help us test this patch on your favorite platform. > > > > > > On powerpc64 I hit > > > /home/polacek/gcc/libsanitizer/asan/asan_linux.cc:209:3: error: #error > > > "Unsupported arch" > > > # error "Unsupported arch" > > > > > > because the merge (aka clang's r196802) removed ppc64 hunk of code: > > > > > > -# 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]; > > > - // 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]; > > > -# elif defined(__sparc__) > > > > Someone will have to send this patch via llvm-commits :( > > (I've pinged Peter Bergner once with no luck).
The following patch gets bootstrap working again, but there seems to be a large number of testsuite failures I will look into before submitting the patch to the LLVM mailing list. Peter Index: libsanitizer/asan/asan_linux.cc =================================================================== --- libsanitizer/asan/asan_linux.cc (revision 210861) +++ libsanitizer/asan/asan_linux.cc (working copy) @@ -186,6 +186,13 @@ void GetPcSpBp(void *context, uptr *pc, *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]; + // 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]; #elif defined(__sparc__) ucontext_t *ucontext = (ucontext_t*)context; uptr *stk_ptr; Index: libsanitizer/asan/asan_mapping.h =================================================================== --- libsanitizer/asan/asan_mapping.h (revision 210861) +++ libsanitizer/asan/asan_mapping.h (working copy) @@ -85,6 +85,7 @@ static const u64 kDefaultShadowOffset64 static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G. static const u64 kAArch64_ShadowOffset64 = 1ULL << 36; static const u64 kMIPS32_ShadowOffset32 = 0x0aaa8000; +static const u64 kPPC64_ShadowOffset64 = 1ULL << 41; static const u64 kFreeBSD_ShadowOffset32 = 1ULL << 30; // 0x40000000 static const u64 kFreeBSD_ShadowOffset64 = 1ULL << 46; // 0x400000000000 @@ -107,6 +108,8 @@ static const u64 kFreeBSD_ShadowOffset64 # else # if defined(__aarch64__) # define SHADOW_OFFSET kAArch64_ShadowOffset64 +# elif defined(__powerpc64__) +# define SHADOW_OFFSET kPPC64_ShadowOffset64 # elif SANITIZER_FREEBSD # define SHADOW_OFFSET kFreeBSD_ShadowOffset64 # elif SANITIZER_MAC Index: libsanitizer/sanitizer_common/sanitizer_common.h =================================================================== --- libsanitizer/sanitizer_common/sanitizer_common.h (revision 210861) +++ libsanitizer/sanitizer_common/sanitizer_common.h (working copy) @@ -26,7 +26,11 @@ struct StackTrace; const uptr kWordSize = SANITIZER_WORDSIZE / 8; const uptr kWordSizeInBits = 8 * kWordSize; -const uptr kCacheLineSize = 64; +#if defined(__powerpc__) || defined(__powerpc64__) + const uptr kCacheLineSize = 128; +#else + const uptr kCacheLineSize = 64; +#endif const uptr kMaxPathLength = 512; Index: libsanitizer/sanitizer_common/sanitizer_stacktrace.cc =================================================================== --- libsanitizer/sanitizer_common/sanitizer_stacktrace.cc (revision 210861) +++ libsanitizer/sanitizer_common/sanitizer_stacktrace.cc (working copy) @@ -16,11 +16,13 @@ namespace __sanitizer { uptr StackTrace::GetPreviousInstructionPc(uptr pc) { -#ifdef __arm__ +#if defined(__arm__) // Cancel Thumb bit. pc = pc & (~1); -#endif -#if defined(__sparc__) +#elif defined(__powerpc__) || defined(__powerpc64__) + // PCs are always 4 byte aligned. + return pc - 4; +#elif defined(__sparc__) return pc - 8; #else return pc - 1;