From patchwork Wed Nov 14 14:43:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 198923 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]) by ozlabs.org (Postfix) with SMTP id 846FE2C00A4 for ; Thu, 15 Nov 2012 01:44:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353509050; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=lo+L71oHlk3NzEFY50BEvSyFn4I=; b=Aasncim9e2T7rrd Axge8QQXvgveTSSL6fToOC+vOPdUPHCM1A+xHW2mau6m15Guu2jX4f/auZjyelMZ T+dZpTP2XJjrvqYofte3hipY1kuhr+etoISPQsnu+k0VBALhxv1kmnxZrZgIKTgT 9WFNXpVbQrBGSdRuZX/UbyRchyg8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=dILnSUCFc1IOEToN5mWcuHGLmaGRob/LtCaZuIeB75hKMZxeuPP9ohEQ/hme/n b6NzuOUcNnrvuwZyQmqW3Gpvi+h2wuAHXQgHLCkS97+ZhdQ3DuxiPloWUfq2Hf87 4pw5XjPxN42pd1VMTAdPJeKLuxTTW8Ok82yPfBnAnOmcc=; Received: (qmail 4422 invoked by alias); 14 Nov 2012 14:44:04 -0000 Received: (qmail 4414 invoked by uid 22791); 14 Nov 2012 14:44:03 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_LV X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Nov 2012 14:43:58 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id 5D96AB005C; Wed, 14 Nov 2012 09:43:57 -0500 (EST) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id qAEEhu30029144; Wed, 14 Nov 2012 09:43:56 -0500 Date: Wed, 14 Nov 2012 09:43:56 -0500 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: wmi@google.com, dodji@redhat.com, mikestump@comcast.net, iain@codesourcery.com, ro@CeBiTec.Uni-Bielefeld.DE Subject: [PATCH][Revised] Enable libsanitizer on darwin Message-ID: <20121114144356.GA29142@bromo.med.uc.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 The attached patch assumes that mach_override/mach_override.h and mach_override/mach_override.c has been imported by the libsanitizer maintainers for use by darwin. The patch adds darwin to the supported target list in configure.tgt and defines USING_MACH_OVERRIDE for darwin in configure.ac. The definition of USING_MACH_OVERRIDE is used in Makefile.am as the test for appending mach_override/mach_override.c to libinterception_la_SOURCES. Tested on x86_64-apple-darwin12 against the mach_override/mach_override.h and mach_override/mach_override.c from llvm compiler-rt 3.2 branch. While there is some noise on the output of asan... http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55289#c14 the functionality of asan appears to be intact. Okay for gcc trunk after the libsanitizer maintainers import the missing mach_override/mach_override.h and mach_override/mach_override.c files? Jack ps Note that this patch assumes that both mach_override.h and mach_override.c reside in a mach_override subdirectory in interception as is the case in the llvm's compiler-rt. pps Patch to configure.tgt revised to use a distinct instance for darwin in the case statement and to limit libsanitizer to i?86 and x86_64 on darwin. libsanitizer/ 2012-11-14 Jack Howarth * configure.tgt: Add darwin to supported targets. * configure.ac: Define USING_MACH_OVERRIDE when on darwin. * interception/Makefile.am: Compile mach_override.c when USING_MACH_OVERRIDE defined. * configure: Regenerated. * interception/Makefile.in: Likewise. Index: libsanitizer/interception/Makefile.am =================================================================== --- libsanitizer/interception/Makefile.am (revision 193500) +++ libsanitizer/interception/Makefile.am (working copy) @@ -11,7 +11,11 @@ interception_files = \ interception_mac.cc \ interception_win.cc -libinterception_la_SOURCES = $(interception_files) +if USING_MACH_OVERRIDE +libinterception_la_SOURCES = $(interception_files) mach_override/mach_override.c +else +libinterception_la_SOURCES = $(interception_files) +endif # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and Index: libsanitizer/configure.ac =================================================================== --- libsanitizer/configure.ac (revision 193500) +++ libsanitizer/configure.ac (working copy) @@ -17,6 +17,12 @@ AM_PROG_LIBTOOL AC_SUBST(enable_shared) AC_SUBST(enable_static) +case "$host" in + *-*-darwin*) MACH_OVERRIDE=true ;; + *) MACH_OVERRIDE=false ;; +esac +AM_CONDITIONAL(USING_MACH_OVERRIDE, $MACH_OVERRIDE) + #AM_ENABLE_MULTILIB(, ..) target_alias=${target_alias-$host_alias} AC_SUBST(target_alias) Index: libsanitizer/configure.tgt =================================================================== --- libsanitizer/configure.tgt (revision 193500) +++ libsanitizer/configure.tgt (working copy) @@ -22,6 +22,8 @@ case "${target}" in x86_64-*-linux* | i?86-*-linux*) ;; + x86_64-*-darwin* | i?86-*-darwin*) + ;; *) UNSUPPORTED=1 ;;