[PATCH] D46857: [CMake] Detect the compiler runtime and standard library

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 18:08:03 PDT 2018


phosek added inline comments.


================
Comment at: compiler-rt/CMakeLists.txt:157
+    list(APPEND SANITIZER_CXX_ABI_LIBRARY "c++")
+  else()
+    if(TARGET cxxabi_shared OR (HAVE_LIBCXXABI AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY))
----------------
vitalybuka wrote:
> What does happen with the unwind?
That's a great question, this is relying on libc++ being a linker script that pulls in all the additional dependencies such as libunwind which is how libc++ is normally installed on platforms that support linker scripts, except for macOS where they use different mechanism but this should still work there. It'd only break on platforms where libunwind has to be linked explicitly, but those are probably broken in current setup as well and I don't know how to easily handle those.


================
Comment at: compiler-rt/cmake/Modules/CompilerRTUtils.cmake:155
       set(CMAKE_EXE_LINKER_FLAGS ${SAVED_CMAKE_EXE_LINKER_FLAGS})
+      message(ERROR "Cannot compile ${TARGET_${arch}_OUTPUT}")
     endif()
----------------
vitalybuka wrote:
> Should this message be in some if() statement? 
This is a leftover debugging print, removed.


================
Comment at: compiler-rt/cmake/Modules/CompilerRTUtils.cmake:329
+  endif()
+  execute_process(
+      COMMAND ${COMPILER_COMMAND}
----------------
vitalybuka wrote:
> why not to use try_compile?
In this case I'm only using `--print-libgcc-file-name` to find out what the runtime is so we don't need to compile anything. I could possibly completely drop this and just use check_link_libraries below and then see if output contains either `libclang_rt.builtins` or `libgcc`, the downside is that I'd need to iterate over all libraries in that list and try to `MATCH` each one of them against the regex which might be slower than actually invoking the compiler again. WDYT?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D46857





More information about the llvm-commits mailing list