[PATCH] D47031: [CMake] Reland "Make simple source used for CMake checks a C file"

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 16:56:18 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT332679: [CMake] Reland "Make simple source used for CMake checks a C file" (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47031?vs=147391&id=147412#toc

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D47031

Files:
  CMakeLists.txt
  cmake/Modules/CompilerRTUtils.cmake
  cmake/config-ix.cmake


Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -125,7 +125,7 @@
 # platform. We use the results of these tests to build only the various target
 # runtime libraries supported by our current compilers cross-compiling
 # abilities.
-set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
+set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.c)
 file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main() { printf(\"hello, world\"); }\n")
 
 # Detect whether the current target platform is 32-bit or 64-bit, and setup
Index: cmake/Modules/CompilerRTUtils.cmake
===================================================================
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -144,8 +144,12 @@
       endif()
       set(SAVED_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
       set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
+      if(SANITIZER_CXX_ABI_SYSTEM)
+        set(FLAG_LINK_LIBRARIES ${SANITIZER_CXX_ABI_LIBRARY})
+      endif()
       try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
                   COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}"
+                  LINK_LIBRARIES ${FLAG_LINK_LIBRARIES}
                   OUTPUT_VARIABLE TARGET_${arch}_OUTPUT)
       set(CMAKE_EXE_LINKER_FLAGS ${SAVED_CMAKE_EXE_LINKER_FLAGS})
     endif()
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -145,6 +145,7 @@
     set(SANITIZER_CXX_ABI_SYSTEM 1)
   else()
     set(SANITIZER_CXX_ABI_LIBNAME "libstdc++")
+    set(SANITIZER_CXX_ABI_SYSTEM 1)
   endif()
 else()
   set(SANITIZER_CXX_ABI_LIBNAME "${SANITIZER_CXX_ABI}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47031.147412.patch
Type: text/x-patch
Size: 1875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180517/5985feb7/attachment.bin>


More information about the llvm-commits mailing list