From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40458 invoked by alias); 16 Jan 2016 13:41:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 40434 invoked by uid 89); 16 Jan 2016 13:41:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=267, 169,7, 440,3, 167,6 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 16 Jan 2016 13:41:43 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 12B05A0A5B; Sat, 16 Jan 2016 13:41:42 +0000 (UTC) Received: from localhost (ovpn-116-32.ams2.redhat.com [10.36.116.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0GDffMY006507; Sat, 16 Jan 2016 08:41:41 -0500 Date: Sat, 16 Jan 2016 13:41:00 -0000 From: Jonathan Wakely To: Jakub Jelinek Cc: David Edelsohn , Torvald Riegel , GCC Patches , "libstdc++@gcc.gnu.org" , Jason Merrill Subject: Re: [PATCH v2] libstdc++: Make certain exceptions transaction_safe. Message-ID: <20160116134140.GO15084@redhat.com> References: <20160116124323.GM15084@redhat.com> <20160116133521.GN3017@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="W/D3X8sky0X3AmG5" Content-Disposition: inline In-Reply-To: <20160116133521.GN3017@tucnak.redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-01/txt/msg01190.txt.bz2 --W/D3X8sky0X3AmG5 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 2132 On 16/01/16 14:35 +0100, Jakub Jelinek wrote: >On Sat, Jan 16, 2016 at 07:47:33AM -0500, David Edelsohn wrote: >> stage1 libstdc++ builds just fine. the problem is stage2 configure >> fails due to missing ITM_xxx symbols when configure tries to compile >> and run conftest programs. > >On x86_64-linux, the _ITM_xxx symbols are undef weak ones and thus it is >fine to load libstdc++ without libitm and libstdc++ doesn't depend on >libitm. > >So, is AIX defining __GXX_WEAK__ or not? Perhaps some other macro or >configure check needs to be used to determine if undefined weak symbols >work the way libstdc++ needs them to. > >#if __GXX_WEAK__ >// Declare all libitm symbols we rely on, but make them weak so that we do >// not depend on libitm. >extern void* _ZGTtnaX (size_t sz) __attribute__((weak)); >extern void _ZGTtdlPv (void* ptr) __attribute__((weak)); >extern uint8_t _ITM_RU1(const uint8_t *p) > ITM_REGPARM __attribute__((weak)); >extern uint32_t _ITM_RU4(const uint32_t *p) > ITM_REGPARM __attribute__((weak)); >extern uint64_t _ITM_RU8(const uint64_t *p) > ITM_REGPARM __attribute__((weak)); >extern void _ITM_memcpyRtWn(void *, const void *, size_t) > ITM_REGPARM __attribute__((weak)); >extern void _ITM_memcpyRnWt(void *, const void *, size_t) > ITM_REGPARM __attribute__((weak)); >extern void _ITM_addUserCommitAction(void (*)(void *), uint64_t, void *) > ITM_REGPARM __attribute__((weak)); > >#else >// If there is no support for weak symbols, create dummies. The exceptions >// will not be declared transaction_safe in this case. >void* _ZGTtnaX (size_t) { return NULL; } >void _ZGTtdlPv (void*) { } >uint8_t _ITM_RU1(const uint8_t *) { return 0; } >uint32_t _ITM_RU4(const uint32_t *) { return 0; } >uint64_t _ITM_RU8(const uint64_t *) { return 0; } >void _ITM_memcpyRtWn(void *, const void *, size_t) { } >void _ITM_memcpyRnWt(void *, const void *, size_t) { } >void _ITM_addUserCommitAction(void (*)(void *), uint64_t, void *) { }; >#endif I think it's better to just drop that whole section of the file if TM isn't supported, as this patch does. Bootstraps OK on AIX, still testing on GNU/Linux. --W/D3X8sky0X3AmG5 Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 2904 commit 16819a03a27de6911140c8e1a249611dc232b30d Author: Jonathan Wakely Date: Sat Jan 16 13:07:02 2016 +0000 Fix bootstrap for targets without TM support PR libstdc++/69312 * include/bits/c++config: Adjust whitespace. * libsupc++/eh_exception.cc: Check feature-test macro for TM support. * src/c++11/cow-stdexcept.cc: Likewise. diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 387a7bb..81d757e 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -490,11 +490,11 @@ namespace std && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \ && !_GLIBCXX_FULLY_DYNAMIC_STRING && __GXX_WEAK__ \ && _GLIBCXX_USE_ALLOCATOR_NEW -#define _GLIBCXX_TXN_SAFE transaction_safe -#define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic +# define _GLIBCXX_TXN_SAFE transaction_safe +# define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic #else -#define _GLIBCXX_TXN_SAFE -#define _GLIBCXX_TXN_SAFE_DYN +# define _GLIBCXX_TXN_SAFE +# define _GLIBCXX_TXN_SAFE_DYN #endif #else // !__cplusplus diff --git a/libstdc++-v3/libsupc++/eh_exception.cc b/libstdc++-v3/libsupc++/eh_exception.cc index 32f9df7..f1a6ffb 100644 --- a/libstdc++-v3/libsupc++/eh_exception.cc +++ b/libstdc++-v3/libsupc++/eh_exception.cc @@ -51,6 +51,7 @@ std::bad_exception::what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT return "std::bad_exception"; } +#if __cpp_transactional_memory >= 201505L // Transactional clones for the destructors and what(). // what() is effectively transaction_pure, but we do not want to annotate it // as such; thus, we call exactly the respective nontransactional function. @@ -84,3 +85,4 @@ _ZGTtNKSt13bad_exception4whatEv( } } +#endif diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index afc3f6c..7211ebe 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -26,6 +26,7 @@ // ISO C++ 14882: 19.1 Exception classes // +#if __cpp_transactional_memory >= 201505L // Enable hooks for support for the Transactional Memory TS (N4514). #define _GLIBCXX_TM_TS_INTERNAL void @@ -40,6 +41,7 @@ void* _txnal_logic_error_get_msg(void* e); void* _txnal_runtime_error_get_msg(void* e); +#endif // All exception classes still use the classic COW std::string. #define _GLIBCXX_USE_CXX11_ABI 0 @@ -167,6 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace +#if __cpp_transactional_memory >= 201505L // Support for the Transactional Memory TS (N4514). // // logic_error and runtime_error both carry a message in the form of a COW @@ -440,3 +443,4 @@ CTORDTOR(14overflow_error, std::overflow_error, runtime_error) CTORDTOR(15underflow_error, std::underflow_error, runtime_error) } +#endif --W/D3X8sky0X3AmG5--