From patchwork Fri May 23 16:47:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 351965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 16CFE140084 for ; Sat, 24 May 2014 02:47:28 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:content-transfer-encoding; q=dns; s= default; b=ByFP5Um2P/ikG85ZuTpV/qHdKmtW0V+IhCjxGQhMkELDZakPFCKER xI+1Blho/Ik1yRqJ3LoJIosGZqFTGAR+gFJn3DdDK/ALvnhmdQIo5P+L9HH05hE4 KIqjeB6+Ma0Iu0EBZc7PdOKE/XaXQByrxhCI0sLI80bkU20Yj83ZDw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:content-transfer-encoding; s=default; bh=sCa18O/g0pzWw4tLOKjYOmZdxbk=; b=IPiIsysplUVCcl87eN9rls0xr0oX df3dRbkdMI4u/stvqdFfpkBJXcK5xgkYy4n1E/JvP/UcdDq8xHpEC1CB7g5bjXS8 W5STp9XV86gqxzhcGw/DEFybDaoguCCuf6P5vry5t6FN8NDUwW1krOVh7P3p9Vvy Jpdq6FHkHBZfyT0= Received: (qmail 4469 invoked by alias); 23 May 2014 16:47:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 4449 invoked by uid 89); 23 May 2014 16:47:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: e31.co.us.ibm.com Received: from e31.co.us.ibm.com (HELO e31.co.us.ibm.com) (32.97.110.149) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 23 May 2014 16:47:20 +0000 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 May 2014 10:47:18 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 23 May 2014 10:47:16 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 25E3F1FF003E for ; Fri, 23 May 2014 10:47:16 -0600 (MDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by b03cxnp08025.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4NGlGgm4850056 for ; Fri, 23 May 2014 18:47:16 +0200 Received: from d03av02.boulder.ibm.com (localhost [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s4NGlGba029645 for ; Fri, 23 May 2014 10:47:16 -0600 Received: from [9.65.127.223] (sig-9-65-127-223.mts.ibm.com [9.65.127.223]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s4NGlDlL029451; Fri, 23 May 2014 10:47:14 -0600 Subject: Re: libsanitizer merge from upstream r208536 From: Peter Bergner To: Konstantin Serebryany Cc: Marek Polacek , GCC Patches , Jakub Jelinek , Dodji Seketeli , Dmitry Vyukov , "H.J. Lu" , Yuri Gribov In-Reply-To: <1400855109.12948.146.camel@otta> References: <20140523134107.GC17600@redhat.com> <1400855109.12948.146.camel@otta> Date: Fri, 23 May 2014 11:47:13 -0500 Message-ID: <1400863633.12948.152.camel@otta> Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14052316-8236-0000-0000-000002910D29 X-IsSubscribed: yes On Fri, 2014-05-23 at 09:25 -0500, Peter Bergner wrote: > xagsmtp4.20140523142452.1860@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 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;