musl's pthread implementations use volatile types in their structs which is not being constexpr in C++11 but is in C++14.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
libc++ was already building with musl after D21637 was commited, but this broke recently as a consequence of r282640 which introduced the use of _LIBCPP_SAFE_STATIC for libc++ internal globals. I'm not sure if this is the best solution, but it's the only one I could come up with, apart from removing the use of _LIBCPP_SAFE_STATIC, which is undesirable, or removing the use of volatile from musl pthread structs, which is unlikely.
musl's pthread implementations use volatile types in their structs which is not being constexpr in C++11 but is in C++14.
This means that libc++'s std::mutex is unsafe to use during dynamic initialization in C++11 with MUSL, which would really suck except that Clang emits always emits the initialization as a constant expression, ever if it's not guaranteed by the core language.
@mclow.lists Do you have any issue bumping the std version while building for MUSL only?
CMakeLists.txt | ||
---|---|---|
327 ↗ | (On Diff #74305) | Why not just set LIBCXX_STANDARD_VER differently instead of replacing it after the fact? |
CMakeLists.txt | ||
---|---|---|
327 ↗ | (On Diff #74305) | I totally missed it; this change was a part of a downstream patch we were using for building Fuchsia toolchain and it predates this option. Using this option, I can override the dialect only for our build, which is perfectly fine for Fuchsia since we default to C++14. I'd be happy to abandon this patch unless you want to persist that setting for musl? |
CMakeLists.txt | ||
---|---|---|
327 ↗ | (On Diff #74305) | Since we support MUSL it would be nice if libc++ built out of the box. Making the option persistent for MUSL makes the most sense to me. |
CMakeLists.txt | ||
---|---|---|
327 ↗ | (On Diff #74305) | We should add a comment here, or where ever this logic ends up going, to explain why this is needed. |
LGTM.
CMakeLists.txt | ||
---|---|---|
331 ↗ | (On Diff #74439) | This should probably overwrite the cache entry. |