aboutsummaryrefslogtreecommitdiff
path: root/cmake/config-ix.cmake
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-09-26 06:53:01 +0000
committerMartin Storsjo <martin@martin.st>2018-09-26 06:53:01 +0000
commitfbd7e01f76344ec9301ab9389a32db52fc348d82 (patch)
tree221e27c25be6da2a35b0b104795e9c5e77efb5f2 /cmake/config-ix.cmake
parent0813450aee6edb6509abc96c67f10817153618dd (diff)
[CMake] [MinGW] Build address sanitizer for MinGW if building with clang
Differential Revision: https://reviews.llvm.org/D51885 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/config-ix.cmake')
-rw-r--r--cmake/config-ix.cmake16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 7332cfd8b..6ab79dc76 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -37,6 +37,19 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
elseif (COMPILER_RT_HAS_GCC_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
endif ()
+ if (MINGW)
+ # Mingw64 requires quite a few "C" runtime libraries in order for basic
+ # programs to link successfully with -nodefaultlibs.
+ if (COMPILER_RT_USE_BUILTINS_LIBRARY)
+ set(MINGW_RUNTIME ${COMPILER_RT_BUILTINS_LIBRARY})
+ else ()
+ set(MINGW_RUNTIME gcc_s gcc)
+ endif()
+ set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
+ shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
+ moldname mingwex msvcrt)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
+ endif()
endif ()
# CodeGen options.
@@ -514,7 +527,8 @@ list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|OpenBSD|Fuchsia|SunOS" OR
- (OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN))))
+ (OS_NAME MATCHES "Windows" AND NOT CYGWIN AND
+ (NOT MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))))
set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
else()
set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)