-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libcxx tests fail when built with gcc (symbol visibility problem) std::__1::__vector_base_common<true>::__throw_length_error() const' #42485
Comments
assigned to @ldionne |
This also looks like it is hitting http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc5-cxx11/builds/372 |
That's very odd. The declaration of __throw_length_error has not changed since 2016, and we've been running gcc bots since before that. I wonder what changed to make that not work. |
Looking at the bot history of libcxx-libcxxabi-x86_64-linux-ubuntu-gcc5-cxx11 (should have thought of that earlier) it looks like http://llvm.org/viewvc/llvm-project?revision=368703&view=revision is what triggered it. [libc++] Always build with -fvisibility=hidden |
Yeah, this is most likely mine. I did test the change on Linux in a Docker image, but it looks like I didn't test on GCC in the Docker image. Looking into it. |
Should be fixed by r370240, please confirm. |
The Arm builder hasn't finished yet, but the other gcc libcxx bots have and I've done a local build on an Arm machine and this error is now gone. I'm still getting some failures, as are the bots, but they look to be separate from this one. Will be worth a look to see if there are other problems when compiling with gcc. Finished GCC builders (28 Failures, down from over 400) Some of the errors are static asserts, but there are also a few undefined symbol link errors. Arm v7 builder, currently testing, will be finished in a few hours: |
Yes, I think my fix did solve the problem for __vector_base_common, but not for all link errors. I'm still working on fixing the rest of them. |
Extended Description
One of our libcxx buildbots http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/builds/1102 is failing.
As a side effect of moving some buildbots around, this builder ended up building libcxx, libcxxabi and libunwind with GCC 7.4.0. With this configuration 437 tests fail due to link errors of the form:
more undefined references to `std::__1::__vector_base_common::__throw_length_error() const' follow
This is reproducible on x86_64 with or without -fno-exceptions and it looks like it is related to symbol visibility differences.
The bits of code where the problem are:
File vector:
template
class __vector_base_common
{
protected:
_LIBCPP_INLINE_VISIBILITY __vector_base_common() {}
_LIBCPP_NORETURN void __throw_length_error() const;
_LIBCPP_NORETURN void __throw_out_of_range() const;
};
template
void
__vector_base_common<__b>::__throw_length_error() const
{
_VSTD::__throw_length_error("vector");
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __vector_base_common)
File stdexcept
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_length_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw length_error(__msg);
#else
((void)__msg);
_VSTD::abort();
#endif
}
When compiled with clang:
00000000 w F .text._ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv 00000018 std::__1::__vector_base_common::__throw_length_error() const
00000000 w F .text._ZNSt3__120__throw_length_errorEPKc 00000010 .hidden std::__1::__throw_length_error(char const*)
When compiled with gcc:
00000000 w F .text._ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv 00000018 .hidden std::__1::__vector_base_common::__throw_length_error() const
Note that std::__1::__vector_base_common::__throw_length_error() const has hidden visibility when compiled with GCC. This is the root cause of the link errors.
This looks to be caused by the expansion of the macros in:
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __vector_base_common)
With GCC this expands to:
extern template class __vector_base_common;
With clang this expands to:
extern template class attribute ((visibility("default"))) __vector_bas
e_common;
With the compilation options -fvisibility=hidden and -fvisibility-inlines-hidden the end result is hidden visibilty when compiled with GCC.
Depending on whether libc++ supports gcc, this is probably a bug.
The text was updated successfully, but these errors were encountered: