From patchwork Fri Feb 8 03:19:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 219033 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 1BCE62C02AE for ; Fri, 8 Feb 2013 14:19:41 +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=1360898383; 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=l0d9jTsq6Szx4IVYg2v+bGvzMec=; b=IDeXKazi0+Qvwyz 3CsdVJ7ylA44/cfr4wS/X8XkANQ+GtyLIvhZmtUlXFzngSJJg0dE0hcTPAXP2WT/ 1sLPNPqvXQM6ABGK+pfiG7Cuog8AtIUcxwLB534k15Wkq8kWOcH/ZFeCrYHn4rvf b+QruaC9tmRgxvdTibHnE/1K/2jo= 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=dnJu4tegX/zXCypfSPdlLF7+NsJNMlG7hRCgykAnliElRVun5ddgZc2CSn+I8D tAI5LDRSm/3lUX7VB5szRjURVO+ZdBSYtL2m1G5BwCobVEEEukZ3957KlACYNPmk 8dBLL5s8KTSAuT9Yam+/B9TW8LC50/ZzdP50Wa1lxyKEY=; Received: (qmail 13851 invoked by alias); 8 Feb 2013 03:19:33 -0000 Received: (qmail 13824 invoked by uid 22791); 8 Feb 2013 03:19:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_CX 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; Fri, 08 Feb 2013 03:19:22 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id 3AA49B0011; Thu, 7 Feb 2013 22:19:21 -0500 (EST) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id r183JKUW015958; Thu, 7 Feb 2013 22:19:20 -0500 Date: Thu, 7 Feb 2013 22:19:20 -0500 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: mikestump@comcast.net, iain@codesourcery.com Subject: [PATCH][Revised} Fix PR libitm/55693 Message-ID: <20130208031920.GA15948@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 revised patch eliminates the failure of the libitm.c++/eh-1.C execution test on darwin10 and later, PR55693. With the introduction of c++ weak-symbol coalescing in Mac OS X 10.6, dyld no longer looks up weak symbols that reside in object files rather than shared libraries. This prevents weak symbols for the dummy functions in libgcc/config/darwin-crt-tm.c from being replaced by those in the libstdc++ shared library. The solution is not to define these dummy symbols when targeting Mac OS X 10.6 or later. Also, the previous hack of not declaring the dummy symbols in libitm/alloc_cpp.cc and libitm/eh_cpp.cc on darwin is reverted as this produces undefined symbols for the combination of darwin10 with Xcode 4.2 (where the dummy symbols are not provided in config/darwin-crt-tm.c but HAVE_ELF_STYLE_WEAKREF is undefined). Bootstrap and regression tested on x86_64-apple-darwin10 with Xcode 3.2.6 and Xcode 4.2 as well as for both x86_64-apple-darwin11 and x86_64-apple-darwin12 with Xcode 4.5.2/4.6. Okay for gcc trunk after testing on darwin9? Jack /libgcc 2013-02-07 Iain Sandoe Jack Howarth PR libitm/55693 * config/darwin-crt-tm.c: Provide dummy functions only prior to 10.6. /gcc 2013-02-07 Iain Sandoe Jack Howarth PR libitm/55693 * gcc/config/darwin.h: Replace ENDFILE_SPEC with TM_DESTRUCTOR and define ENDFILE_SPEC as TM_DESTRUCTOR. * config/i386/darwin.h (ENDFILE_SPEC): Use TM_DESTRUCTOR. /libitm 2013-02-07 Iain Sandoe Jack Howarth PR libitm/55693 * alloc_cpp.cc: Enable dummy funtions on darwin. * eh_cpp.cc: Likewise. Index: libgcc/config/darwin-crt-tm.c =================================================================== --- libgcc/config/darwin-crt-tm.c (revision 195764) +++ libgcc/config/darwin-crt-tm.c (working copy) @@ -103,9 +103,12 @@ void __doTMdeRegistrations (void) _ITM_deregisterTMCloneTable (tmct); } +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060 + /* 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. */ + Don't define for 10.6 or later with faster weak-symbol coalescing. */ extern void *__cxa_allocate_exception (size_t) WEAK; extern void __cxa_throw (void *, void *, void *) WEAK; @@ -144,5 +147,5 @@ void _ZdlPvRKSt9nothrow_t (void * a UNUS 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; } - +#endif #endif Index: gcc/config/i386/darwin.h =================================================================== --- gcc/config/i386/darwin.h (revision 195764) +++ gcc/config/i386/darwin.h (working copy) @@ -131,8 +131,7 @@ extern int darwin_emit_branch_islands; "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ - %{mpc80:crtprec80.o%s} \ - %{fgnu-tm: -lcrttme.o}" + %{mpc80:crtprec80.o%s}" TM_DESTRUCTOR #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 195764) +++ gcc/config/darwin.h (working copy) @@ -363,7 +363,8 @@ extern GTY(()) int darwin_ms_struct; %{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}" /* We want a destructor last in the list. */ -#define ENDFILE_SPEC "%{fgnu-tm: -lcrttme.o}" +#define TM_DESTRUCTOR "%{fgnu-tm: -lcrttme.o}" +#define ENDFILE_SPEC TM_DESTRUCTOR #define DARWIN_EXTRA_SPECS \ { "darwin_crt1", DARWIN_CRT1_SPEC }, \ Index: libitm/alloc_cpp.cc =================================================================== --- libitm/alloc_cpp.cc (revision 195861) +++ libitm/alloc_cpp.cc (working copy) @@ -60,7 +60,7 @@ 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) && !defined (__MACH__) +#if !defined (HAVE_ELF_STYLE_WEAKREF) 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 195861) +++ libitm/eh_cpp.cc (working copy) @@ -39,7 +39,7 @@ extern void __cxa_end_catch (void) WEAK; extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK; -#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined (__MACH__) +#if !defined (HAVE_ELF_STYLE_WEAKREF) void *__cxa_allocate_exception (size_t) { return NULL; } void __cxa_throw (void *, void *, void *) { return; } void *__cxa_begin_catch (void *) { return NULL; }