[PATCH] D23719: [libc++] Use C11 for atomics check

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 19 15:21:43 PDT 2016


smeenai planned changes to this revision.
smeenai added a comment.

@rsmith: I think your points are valid, and I should have been more explicit with the motivation :)

The issue is with linking, not with compiling. When we call `check_cxx_source_compiles`, the compiler driver passes all the standard C++ libraries for the platform to the link step, which can lead to spurious link failures when cross-compiling during the configure step, which then manifest as a bad configuration.

When we're compiling the library itself, we pass `-nodefaultlibs` to the driver <https://reviews.llvm.org/diffusion/L/browse/libcxx/trunk/lib/CMakeLists.txt;279330$76> to avoid the standard libraries from creeping in, and then explicitly add any required libraries <https://reviews.llvm.org/diffusion/L/browse/libcxx/trunk/lib/CMakeLists.txt;279330$66-72>. Conceptually, I want to do the same for any `check_cxx_source_compiles` calls, so that the configuration linking behavior matches the library linking behavior. I'm thinking the best way to accomplish this is to globally add `-nodefaultlib` to `CMAKE_REQUIRED_FLAGS`, and then globally set `CMAKE_REQUIRED_LIBRARIES` to the required set of libraries, similar to what the library build is doing. Does that make sense?


https://reviews.llvm.org/D23719





More information about the cfe-commits mailing list