Message ID | 20160116124323.GM15084@redhat.com |
---|---|
State | New |
Headers | show |
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. Thanks, David On Sat, Jan 16, 2016 at 7:43 AM, Jonathan Wakely <jwakely@redhat.com> wrote: > What are the errors? > > I can build libstdc++ on gcc111. > > Does this patch help? > >
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 Jakub
On Sat, 2016-01-16 at 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. David, if you can tell me what AIX supports and whether it defines __GXX_WEAK__ with the semantics we assume here, I can see what a fix would be. As Jakub says, the point of all what's below is to actually make it work when there's no TM support. Also, knowing the actual error that AIX fails with would be helpful. I have no access to AIX, so can't check. Thanks. > #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 > > Jakub
Torvald, The error is a link failure in stage2 configure due to the missing _ITM_xxx and related symbols. I don't have the failed build any more. Maybe Jonathan can reply with the specific failures. There is an AIX system in the GNU Compile Farm: gcc111. - David On Sat, Jan 16, 2016 at 3:12 PM, Torvald Riegel <triegel@redhat.com> wrote: > On Sat, 2016-01-16 at 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. > > David, if you can tell me what AIX supports and whether it defines > __GXX_WEAK__ with the semantics we assume here, I can see what a fix > would be. As Jakub says, the point of all what's below is to actually > make it work when there's no TM support. > > Also, knowing the actual error that AIX fails with would be helpful. I > have no access to AIX, so can't check. Thanks. > >> #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 >> >> Jakub > > >
On Sat, Jan 16, 2016 at 8:35 AM, Jakub Jelinek <jakub@redhat.com> 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. __GXX_WEAK__ appears to be defined by gcc/c-family/c-cppbuiltin.c based on SUPPORTS_ONE_ONLY. gcc/defaults.h defines SUPPORTS_ONE_ONLY if the target supports MAKE_DECL_ONE_ONLY and link-once semantics. AIX weak correctly supports link-once semantics. AIX also supports the definition of __GXX_WEAK__ in gcc/doc/cpp.texi, namely collapsing symbols with vague linkage in multiple translation units. libstdc++/src/c++11/cow-stdexcept.cc appears to be using __GXX_WEAK__ and __attribute__ ((weak)) for references to symbols that may not be defined at link time or run time. AIX does not allow undefined symbol errors by default. And the libstdc++ inference about the semantics of __GXX_WEAK__ are different than the documentation. AIX supports MAKE_DECL_ONE_ONLY and the documented meaning of __GXX_WEAK__. AIX does not support extension of the meaning to additional SVR4 semantics not specified in the documentation. Thanks, David
diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index afc3f6c..8a1b65a 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -27,6 +27,7 @@ // // Enable hooks for support for the Transactional Memory TS (N4514). +#if __cpp_transactional_memory >= 201505L #define _GLIBCXX_TM_TS_INTERNAL void _txnal_cow_string_C1_for_exceptions(void* that, const char* s, void* exc); @@ -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