From patchwork Mon Feb 11 16:06:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 219632 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 4B8562C02F5 for ; Tue, 12 Feb 2013 03:06:46 +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=1361203607; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Subject:MIME-Version:Content-Type:From:In-Reply-To:Date: CC:Message-ID:References:To:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=KIomQ/+l/E91obE5TPv8emKJh4E=; b=NpyW7f4b0l25N6M 23HDdGnZGgj1sbfcEgfQKwQ5ebXejkH1ISZRVKJeL7HD8mN6kl9QPQeMr9fO/hWK xLAoctqE7r+T8OHZlZw5+3VCPnCyTivnQmYDjP8mXgiUvxssQE2mMbzDe1WWv/yj VU5GGfzgpD0jSIlR9dIWF9W9i81A= 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:Received:Subject:MIME-Version:Content-Type:From:In-Reply-To:Date:CC:Message-ID:References:To:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Xa6JPhR8qyFYcusyiOixjBgle2zcZZcFGYDRmWTo+GHKucjeQggCpXRJj+ss+7 YHW5gRvhKNPy1VAIpVOuP80p3YbSlSa2OEUM56wr5PupWzjEHLHWBBVjf8SGo3qp WpbgoqHNXglekPAPkey+10NBEm1n4SXdPT99CZkw18jL8=; Received: (qmail 6521 invoked by alias); 11 Feb 2013 16:06:39 -0000 Received: (qmail 6501 invoked by uid 22791); 11 Feb 2013 16:06:37 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Feb 2013 16:06:30 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1U4vtk-0002Lf-Ph from Iain_Sandoe@mentor.com ; Mon, 11 Feb 2013 08:06:28 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 11 Feb 2013 08:06:28 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Mon, 11 Feb 2013 16:06:26 +0000 Subject: Re: [PATCH] Disable libsanitizer before darwin10 MIME-Version: 1.0 (Apple Message framework v1085) From: Iain Sandoe In-Reply-To: <20130211155501.GA31314@bromo.med.uc.edu> Date: Mon, 11 Feb 2013 16:06:21 +0000 CC: Jack Howarth , , , , , Message-ID: <419A3F06-344A-467A-9708-343E9E8CC2D2@codesourcery.com> References: <20130211155501.GA31314@bromo.med.uc.edu> To: GCC Patches 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 On 11 Feb 2013, at 15:55, Jack Howarth wrote: > Iain Sandoe discovered that on intel darwin9, the asan testsuite suffers hundreds of > failures due to the absence of dispatch calls (Grand Central Dispatch) prior to darwin10. > The attached patch disables building libsanitizer on darwin8 and darwin9 until upstream > decides to support the earlier darwin releases. Bootstrap and regression tested on > x86_64-apple-darwin12. Okay for gcc trunk? note that making Darwin9 work is not that difficult - simply avoid the GCD calls (example hack attached). However, the question is open as to whether upstream is willing to include code to cater for older Darwin (TBD). If such a change would be OK there, then the attached could be cleaned up/amended. (it reduces the fails on i686-Darwin9 from 'all' asan to ~10 each for C on x86/x86_64 and similar for C++) Iain Index: libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc =================================================================== --- libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc (revision 195915) +++ libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc (working copy) @@ -84,6 +84,10 @@ INTERPOSE_FUNCTION(mlockall), INTERPOSE_FUNCTION(munlockall), #endif + +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 + INTERPOSE_FUNCTION(dispatch_async_f), INTERPOSE_FUNCTION(dispatch_sync_f), INTERPOSE_FUNCTION(dispatch_after_f), @@ -96,14 +100,19 @@ INTERPOSE_FUNCTION(dispatch_source_set_event_handler), INTERPOSE_FUNCTION(dispatch_source_set_cancel_handler), #endif +#endif INTERPOSE_FUNCTION(signal), INTERPOSE_FUNCTION(sigaction), INTERPOSE_FUNCTION(malloc_create_zone), INTERPOSE_FUNCTION(malloc_default_zone), + +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 INTERPOSE_FUNCTION(malloc_default_purgeable_zone), INTERPOSE_FUNCTION(malloc_make_purgeable), INTERPOSE_FUNCTION(malloc_make_nonpurgeable), +#endif INTERPOSE_FUNCTION(malloc_set_zone_name), INTERPOSE_FUNCTION(malloc), INTERPOSE_FUNCTION(free), @@ -111,7 +120,10 @@ INTERPOSE_FUNCTION(calloc), INTERPOSE_FUNCTION(valloc), INTERPOSE_FUNCTION(malloc_good_size), +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 INTERPOSE_FUNCTION(posix_memalign), +#endif }; } // namespace __asan Index: libsanitizer/asan/asan_mac.cc =================================================================== --- libsanitizer/asan/asan_mac.cc (revision 195915) +++ libsanitizer/asan/asan_mac.cc (working copy) @@ -197,6 +197,8 @@ return err_none; } +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 // Support for the following functions from libdispatch on Mac OS: // dispatch_async_f() // dispatch_async() @@ -285,10 +287,12 @@ context->func(context->block); asan_free(context, &stack, FROM_MALLOC); } - +#endif } // namespace __asan using namespace __asan; // NOLINT +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 // Wrap |ctxt| and |func| into an asan_block_context_t. // The caller retains control of the allocated context. @@ -319,6 +323,7 @@ asan_dispatch_call_block_and_release); \ } + INTERCEPT_DISPATCH_X_F_3(dispatch_async_f) INTERCEPT_DISPATCH_X_F_3(dispatch_sync_f) INTERCEPT_DISPATCH_X_F_3(dispatch_barrier_async_f) @@ -421,5 +426,6 @@ } } // namespace __asan +#endif #endif // __APPLE__ Index: libsanitizer/asan/asan_malloc_mac.cc =================================================================== --- libsanitizer/asan/asan_malloc_mac.cc (revision 195915) +++ libsanitizer/asan/asan_malloc_mac.cc (working copy) @@ -52,6 +52,9 @@ return &asan_zone; } +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 + INTERCEPTOR(malloc_zone_t *, malloc_default_purgeable_zone, void) { // FIXME: ASan should support purgeable allocations. // https://code.google.com/p/address-sanitizer/issues/detail?id=139 @@ -73,6 +76,7 @@ // malloc_make_purgeable(). return 0; } +#endif INTERCEPTOR(void, malloc_set_zone_name, malloc_zone_t *zone, const char *name) { if (!asan_inited) __asan_init(); @@ -126,6 +130,9 @@ return asan_zone.introspect->good_size(&asan_zone, size); } +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 + INTERCEPTOR(int, posix_memalign, void **memptr, size_t alignment, size_t size) { if (!asan_inited) __asan_init(); CHECK(memptr); @@ -137,7 +144,7 @@ } return -1; } - +#endif namespace { // TODO(glider): the mz_* functions should be united with the Linux wrappers,