================ @@ -38,9 +38,13 @@ check_cxx_compiler_flag(-nolibc CXX_SUPPORTS_NOLIBC_FLAG) # required during compilation (which has the -nostdlib++ or -nodefaultlibs). libc is # required for the link to go through. We remove sanitizers from the # configuration checks to avoid spurious link errors. +# +# Adding flags to CMAKE_REQUIRED_FLAGS will include the flags both when testing +# compilation of C and C++. Therefore test to make sure that the flags are +# supported by the C compiler driver, before deciding to include them. -check_cxx_compiler_flag(-nostdlib++ CXX_SUPPORTS_NOSTDLIBXX_FLAG) -if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) +check_c_compiler_flag(-nostdlib++ C_SUPPORTS_NOSTDLIBXX_FLAG) ---------------- ldionne wrote:
Do we compile any C sources in libc++? Why do we care what flags the C compiler supports for libc++ and libc++abi? (I understand why it matters for libunwind where we do have C sources). The reason I'm asking is that there are some simplifications we can make if we assume that all supported compilers accept `-nostdlib++`, and this patch makes it impossible to make that assumption. https://github.com/llvm/llvm-project/pull/108357 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits