[PATCH] D24092: [compiler-rt] Allow sanitizers to be compiled for windows with clang

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 14:11:55 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL280863: [compiler-rt] Allow sanitizers to be compiled for windows with clang (authored by fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D24092?vs=70581&id=70594#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24092

Files:
  compiler-rt/trunk/cmake/config-ix.cmake
  compiler-rt/trunk/lib/asan/CMakeLists.txt

Index: compiler-rt/trunk/lib/asan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt
@@ -212,11 +212,19 @@
         CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK
         DEFS ${ASAN_COMMON_DEFINITIONS}
         PARENT_TARGET asan)
+
+      set(DYNAMIC_RUNTIME_THUNK_CFLAGS "-DASAN_DYNAMIC_RUNTIME_THUNK")
+      if(MSVC)
+        list(APPEND DYNAMIC_RUNTIME_THUNK_CFLAGS "-Zl")
+      elseif(CMAKE_C_COMPILER_ID MATCHES Clang)
+        list(APPEND DYNAMIC_RUNTIME_THUNK_CFLAGS "-nodefaultlibs")
+      endif()
+
       add_compiler_rt_runtime(clang_rt.asan_dynamic_runtime_thunk
         STATIC
         ARCHS ${arch}
         SOURCES asan_win_dynamic_runtime_thunk.cc
-        CFLAGS ${ASAN_CFLAGS} -DASAN_DYNAMIC_RUNTIME_THUNK -Zl
+        CFLAGS ${ASAN_CFLAGS} ${DYNAMIC_RUNTIME_THUNK_CFLAGS}
         DEFS ${ASAN_COMMON_DEFINITIONS}
         PARENT_TARGET asan)
     endif()
Index: compiler-rt/trunk/cmake/config-ix.cmake
===================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake
+++ compiler-rt/trunk/cmake/config-ix.cmake
@@ -415,7 +415,7 @@
 
 if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
     (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
-    (OS_NAME MATCHES "Windows" AND MSVC)))
+    (OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN))))
   set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
 else()
   set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24092.70594.patch
Type: text/x-patch
Size: 1557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160907/ea266ca2/attachment.bin>


More information about the llvm-commits mailing list