From patchwork Wed Feb 15 23:39:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Marlier X-Patchwork-Id: 141433 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 51AF21007D8 for ; Thu, 16 Feb 2012 10:41: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=1329954071; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=J/KM5RoQ81BRkCpz/am66LMmnhc=; b=cmYuNGbiu+a4FHG hRn4M3WmxWARc65dKWJWLuoFWzgjMipNPuShl/uaBkT4rMSKIicDJL4LRU9Tqpu3 sZayRgXlnBNau1zA6uB4MoBiNC6TMsv7+jaE6yKUi5SmBUpL9RXUJwPCtQQhYJN4 FLcpbTvM1RCMnjmzMI/ejMpD8HqM= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=DFFFFuZurJKHa+A7XnVtfMVKpOLncxlQDz3Ic9LIxDOw8KQaJjm3RLrF9aT4P0 3fnDcfxVmQ+b1Si+lXELivcwiQeyOLljTh+5nTLlVWbBziU6P519DihpOoGgCAiB Smoq5q21klhhcTlbzHWvZhYpzzafDBcAciuylF8U82h6Q=; Received: (qmail 529 invoked by alias); 15 Feb 2012 23:40:26 -0000 Received: (qmail 302 invoked by uid 22791); 15 Feb 2012 23:40:21 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_CX X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Feb 2012 23:39:38 +0000 Received: by qadz30 with SMTP id z30so4040739qad.20 for ; Wed, 15 Feb 2012 15:39:37 -0800 (PST) Received: by 10.229.137.144 with SMTP id w16mr206688qct.8.1329349177022; Wed, 15 Feb 2012 15:39:37 -0800 (PST) Received: from [192.168.2.2] (cpe-69-207-95-157.rochester.res.rr.com. [69.207.95.157]) by mx.google.com with ESMTPS id bd19sm13798332qab.17.2012.02.15.15.39.35 (version=SSLv3 cipher=OTHER); Wed, 15 Feb 2012 15:39:36 -0800 (PST) Message-ID: <4F3C4236.1070701@gmail.com> Date: Wed, 15 Feb 2012 18:39:34 -0500 From: Patrick Marlier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111229 Thunderbird/9.0 MIME-Version: 1.0 To: gcc-patches CC: Mike Stump , Iain Sandoe , Jack Howarth Subject: [libitm, darwin] PR52220 move dummy functions definition X-IsSubscribed: yes 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 Hi, In PR/52220, eh-1.C fails because the dummy function __cxa_allocate_exception is used instead of the one from libstdc++. Indeed, the function is defined in libitm and thus is used. The fix consists to move the dummy function definitions to darwin-crt-tm.c. This fix was mainly contributed by Iain Sandoe. This was approved off-list by Mike Stump. Committed and tested on darwin 10/11. --- Patrick. libitm/ 2012-02-15 Iain Sandoe Patrick Marlier PR libitm/52220 * alloc_cpp.cc: No dummy definitions for darwin. * eh_cpp.cc: Likewise. libgcc/ 2012-02-15 Iain Sandoe Patrick Marlier PR libitm/52220 * config/darwin-crt-tm.c: Generate dummy functions. Index: libitm/alloc_cpp.cc =================================================================== --- libitm/alloc_cpp.cc (revision 184291) +++ libitm/alloc_cpp.cc (working copy) @@ -60,7 +60,7 @@ extern void _ZdlPvRKSt9nothrow_t (void *, c_nothro extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak)); extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak)); -#if !defined (HAVE_ELF_STYLE_WEAKREF) +#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined (__MACH__) void *_ZnwX (size_t) { return NULL; } void _ZdlPv (void *) { return; } void *_ZnaX (size_t) { return NULL; } Index: libitm/eh_cpp.cc =================================================================== --- libitm/eh_cpp.cc (revision 184291) +++ libitm/eh_cpp.cc (working copy) @@ -39,7 +39,7 @@ extern void *__cxa_begin_catch (void *) WEAK; extern void *__cxa_end_catch (void) WEAK; extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK; -#if !defined (HAVE_ELF_STYLE_WEAKREF) +#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined (__MACH__) void *__cxa_allocate_exception (size_t) { return NULL; } void __cxa_throw (void *, void *, void *) { return; } void *__cxa_begin_catch (void *) { return NULL; } Index: libgcc/config/darwin-crt-tm.c =================================================================== --- libgcc/config/darwin-crt-tm.c (revision 184291) +++ libgcc/config/darwin-crt-tm.c (working copy) @@ -39,6 +39,7 @@ see the files COPYING3 and COPYING.RUNTIME respect #endif #define WEAK __attribute__((weak)) +#define UNUSED __attribute__((unused)) extern void _ITM_registerTMCloneTable (void *, size_t) WEAK; extern void _ITM_deregisterTMCloneTable (void *) WEAK; @@ -103,3 +104,46 @@ void __doTMdeRegistrations (void) } #endif + +/* Provide dummy functions to satisfy linkage for versions of the Darwin + tool-chain that that can't handle undefined weak refs at the link stage. + ??? Define these dummy functions only when !HAVE_ELF_STYLE_WEAKREF. */ + +extern void *__cxa_allocate_exception (size_t) WEAK; +extern void __cxa_throw (void *, void *, void *) WEAK; +extern void *__cxa_begin_catch (void *) WEAK; +extern void *__cxa_end_catch (void) WEAK; +extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK; + +extern void *_ZnwX (size_t) WEAK; +extern void _ZdlPv (void *) WEAK; +extern void *_ZnaX (size_t) WEAK; +extern void _ZdaPv (void *) WEAK; + +typedef const struct nothrow_t { } *c_nothrow_p; + +extern void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK; +extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK; +extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK; +extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK; + +void *__cxa_allocate_exception (size_t s UNUSED) { return NULL; } +void __cxa_throw (void * a UNUSED, void * b UNUSED, void * c UNUSED) + { return; } +void *__cxa_begin_catch (void * a UNUSED) { return NULL; } +void *__cxa_end_catch (void) { return NULL; } +void __cxa_tm_cleanup (void * a UNUSED, void * b UNUSED, unsigned int c UNUSED) + { return; } + +void *_ZnwX (size_t s UNUSED) { return NULL; } +void _ZdlPv (void * a UNUSED) { return; } +void *_ZnaX (size_t s UNUSED) { return NULL; } +void _ZdaPv (void * a UNUSED) { return; } + +void *_ZnwXRKSt9nothrow_t (size_t s UNUSED, c_nothrow_p b UNUSED) + { return NULL; } +void _ZdlPvRKSt9nothrow_t (void * a UNUSED, c_nothrow_p b UNUSED) { return; } +void *_ZnaXRKSt9nothrow_t (size_t s UNUSED, c_nothrow_p b UNUSED) + { return NULL; } +void _ZdaPvRKSt9nothrow_t (void * a UNUSED, c_nothrow_p b UNUSED) { return; } +