From patchwork Mon Feb 6 00:12:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 139671 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 EE206B722B for ; Mon, 6 Feb 2012 11:13:24 +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=1329092005; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=cmY4ufx agm/v1ZT/lGwGVb89Lfg=; b=JRasZCYdKbKRJc7sSfP79+1hv0/FLqNdiMcCTbs lxfu97EdOYxExhFgQZHWmFXwkt96swkeW4bAYS887M2CM4ecT3WAixVBCME1aHhR BCMThMXhk7t9yGeyUX7r3pq+CR4EKiDo8KsVDfirdKXuop/xU+ugSqgD2TefWqVQ vzzU= 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:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WBp/ul5YV7p35zLVv02EEu5cdc3YM52w5VEY31H3zgIKy/bMxLtP0nQKFxCGtN i51bRvCCL30XrUo3yGXhAx3V94KH7xvcV90bq7svdJnQUGSF6xzbIAY5YMpqntn8 SVwCmIgffeIO/+Yz48Dt5v4Wrxna7Nq44ppOfVwO1A9EE=; Received: (qmail 17008 invoked by alias); 6 Feb 2012 00:13:11 -0000 Received: (qmail 16982 invoked by uid 22791); 6 Feb 2012 00:13:06 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-lpp01m010-f47.google.com (HELO mail-lpp01m010-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Feb 2012 00:12:44 +0000 Received: by lahc1 with SMTP id c1so2818621lah.20 for ; Sun, 05 Feb 2012 16:12:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.147.202 with SMTP id tm10mr8914178lab.49.1328487162456; Sun, 05 Feb 2012 16:12:42 -0800 (PST) Received: by 10.112.39.42 with HTTP; Sun, 5 Feb 2012 16:12:42 -0800 (PST) Date: Mon, 6 Feb 2012 00:12:42 +0000 Message-ID: Subject: libstdc++/52104 - fix linker error for non-TLS targets From: Jonathan Wakely To: "libstdc++" , 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 The out-of-line destructor in future.cc uses std::call_once which uses a lambda on TLS targets. Because we compile with -fno-implicit-templates an explicit instantiation is needed, but can't be done because the closure type created by the lambda can't be named. This puts the destructor inline in the header for TLS targets. A better fix would be to avoid using a lambda in std::call_once, but I don't want to touch that code instage4. PR libstdc++/52104 * include/std/future (__future_base::_Async_state_common): Define destructor inline for targets without TLS. * src/c++11/future.cc (__future_base::_Async_state_common): Only define destructor for TLS targets. Tested x86_64-linux by me and on sparc-solaris by Eric Botcazou. Committed to trunk. diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 1093e3f..962400b 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -1425,7 +1425,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __future_base::_Async_state_common : public __future_base::_State_base { protected: +#ifdef _GLIBCXX_HAVE_TLS ~_Async_state_common(); +#else + ~_Async_state_common() { _M_join(); } +#endif // Allow non-timed waiting functions to block until the thread completes, // as if joined. diff --git a/libstdc++-v3/src/c++11/future.cc b/libstdc++-v3/src/c++11/future.cc index dab0774..61a9729 100644 --- a/libstdc++-v3/src/c++11/future.cc +++ b/libstdc++-v3/src/c++11/future.cc @@ -85,11 +85,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __future_base::_State_base::~_State_base() = default; +#ifdef _GLIBCXX_HAVE_TLS __future_base::_Async_state_common::~_Async_state_common() { _M_join(); } // Explicit instantiation due to -fno-implicit-instantiation. template void call_once(once_flag&, void (thread::*&&)(), reference_wrapper&&); #endif +#endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std