-
Notifications
You must be signed in to change notification settings - Fork 159
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
clang++-libc++ with clang6 and libcxxabi does support thread_local #231
Comments
Did some digging and that commit to libcxxabi looks like it was included in clang4. Here's the patch I'm currently using. It might break some users that aren't using libcxxabi though.. not really too sure on the best way to handle this. --- boost/config/stdlib/libcpp.hpp 2018-07-26 10:09:30.091065048 +1000
+++ boost/config/stdlib/libcpp.hpp 2018-07-26 10:14:24.641990321 +1000
@@ -113,10 +113,16 @@
# define BOOST_NO_CXX11_THREAD_LOCAL
#endif
-#if defined(__linux__) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
+#if defined(__linux__) && _LIBCPP_VERSION < 4000 && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
// After libc++-dev is installed on Trusty, clang++-libc++ almost works,
// except uses of `thread_local` fail with undefined reference to
// `__cxa_thread_atexit`.
+//
+// clang's libc++abi provides an implementation by deferring to the glibc
+// implementation, which may or may not be available (it is not on Trusty).
+// clang 4's libc++abi will provide an implementation if one is not in glibc
+// though, so thread local support should work with clang 4 and above as long
+// as libc++abi is linked in.
# define BOOST_NO_CXX11_THREAD_LOCAL
#endif
|
Confirmed as working with Ubuntu clang-6 packages at least. |
Spoke too soon.... failed CI testing with clang-5. Updating the CI tests and waiting for them to cycle... |
CI is passing now, not sure if we have all the wrinkles sorted, but it's better than it was. |
I've been upgrading some company internal projects to use a clang6 toolchain, and discovered that the fix in #208 is causing boost::fiber to not build since it thinks
thread_local
isn't available.I can successfully build and run the test case in
boost_no_cxx11_thread_local.ipp
when i import it in to the project (we're using cmake). This is with the compiler flags:Checking the symbols against the debian 8 prebuilts from http://releases.llvm.org/
So it seems that clang3's libc++abi didn't have support for
__cxa_thread_atexit
, but newer versions do by deferring to glibc's implementation.The feature check should probably be changed to detect the clang version?
This may not work 100% of the time though, since it depends on what standard library is being linked in and if libcxxabi is being linked in. Based on the commit llvm-mirror/libcxxabi@3f7b370 more recent versions of clang will attempt to provide a fallback in libcxxabi if glibc does not have an implementation, so perhaps require a very recent version of clang?
The text was updated successfully, but these errors were encountered: