blob: 60dae9cf0b8b58ba8e2fdd5e28b103a8d071cdd7 [file] [log] [blame]
Stephen Hines86277eb2015-03-23 12:06:32 -07001include(CMakePushCheckState)
Stephen Hines2d1fdb22014-05-28 23:58:16 -07002include(CheckCXXCompilerFlag)
3include(CheckLibraryExists)
4include(CheckSymbolExists)
Stephen Hines86277eb2015-03-23 12:06:32 -07005include(TestBigEndian)
Stephen Hines2d1fdb22014-05-28 23:58:16 -07006
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -07007function(check_linker_flag flag out_var)
8 cmake_push_check_state()
9 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
10 check_cxx_compiler_flag("" ${out_var})
11 cmake_pop_check_state()
12endfunction()
13
Stephen Hines2d1fdb22014-05-28 23:58:16 -070014# CodeGen options.
15check_cxx_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
16check_cxx_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG)
17check_cxx_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
18check_cxx_compiler_flag(-fno-exceptions COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
19check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)
20check_cxx_compiler_flag(-funwind-tables COMPILER_RT_HAS_FUNWIND_TABLES_FLAG)
21check_cxx_compiler_flag(-fno-stack-protector COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG)
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -070022check_cxx_compiler_flag(-fno-sanitize=safe-stack COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070023check_cxx_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
24check_cxx_compiler_flag(-fno-rtti COMPILER_RT_HAS_FNO_RTTI_FLAG)
25check_cxx_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
26check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
27check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
28check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
Stephen Hines86277eb2015-03-23 12:06:32 -070029check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
30check_cxx_compiler_flag(-msse3 COMPILER_RT_HAS_MSSE3_FLAG)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070031
32check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
33check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
34check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
35check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
36
37# Debug info flags.
38check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
39check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
40check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
Stephen Hines86277eb2015-03-23 12:06:32 -070041
Stephen Hines2d1fdb22014-05-28 23:58:16 -070042# Warnings.
43check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
44check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
45check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG)
46check_cxx_compiler_flag("-Werror -Wglobal-constructors" COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)
Stephen Hines6d186232014-11-26 17:56:19 -080047check_cxx_compiler_flag("-Werror -Wc99-extensions" COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG)
48check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG)
49check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG)
50check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070051
52check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
53check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
Stephen Hines6d186232014-11-26 17:56:19 -080054check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)
55check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)
56check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070057check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
Stephen Hines6d186232014-11-26 17:56:19 -080058check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070059
60# Symbols.
61check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
62
63# Libraries.
Stephen Hines6d186232014-11-26 17:56:19 -080064check_library_exists(c printf "" COMPILER_RT_HAS_LIBC)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070065check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -070066check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT)
Stephen Hines6d186232014-11-26 17:56:19 -080067check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070068check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
Stephen Hines6d186232014-11-26 17:56:19 -080069check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
70
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -070071# Linker flags.
72if(ANDROID)
73 check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
74endif()
75
Stephen Hines6d186232014-11-26 17:56:19 -080076# Architectures.
77
78# List of all architectures we can target.
79set(COMPILER_RT_SUPPORTED_ARCH)
80
81# Try to compile a very simple source file to ensure we can target the given
82# platform. We use the results of these tests to build only the various target
83# runtime libraries supported by our current compilers cross-compiling
84# abilities.
85set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
86file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <limits>\nint main() {}\n")
87
Stephen Hines86277eb2015-03-23 12:06:32 -070088function(check_compile_definition def argstring out_var)
89 if("${def}" STREQUAL "")
90 set(${out_var} TRUE PARENT_SCOPE)
91 return()
92 endif()
93 cmake_push_check_state()
94 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${argstring}")
95 check_symbol_exists(${def} "" ${out_var})
96 cmake_pop_check_state()
97endfunction()
98
99# test_target_arch(<arch> <def> <target flags...>)
100# Checks if architecture is supported: runs host compiler with provided
101# flags to verify that:
102# 1) <def> is defined (if non-empty)
103# 2) simple file can be successfully built.
104# If successful, saves target flags for this architecture.
105macro(test_target_arch arch def)
Stephen Hines6d186232014-11-26 17:56:19 -0800106 set(TARGET_${arch}_CFLAGS ${ARGN})
Stephen Hines86277eb2015-03-23 12:06:32 -0700107 set(argstring "")
Stephen Hines6d186232014-11-26 17:56:19 -0800108 foreach(arg ${ARGN})
109 set(argstring "${argstring} ${arg}")
110 endforeach()
Stephen Hines86277eb2015-03-23 12:06:32 -0700111 check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
112 if(NOT HAS_${arch}_DEF)
113 set(CAN_TARGET_${arch} FALSE)
114 else()
115 set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
116 try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
117 COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}"
118 OUTPUT_VARIABLE TARGET_${arch}_OUTPUT
119 CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}")
120 endif()
Stephen Hines6d186232014-11-26 17:56:19 -0800121 if(${CAN_TARGET_${arch}})
122 list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
123 elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "${arch}")
124 # Bail out if we cannot target the architecture we plan to test.
125 message(FATAL_ERROR "Cannot compile for ${arch}:\n${TARGET_${arch}_OUTPUT}")
126 endif()
127endmacro()
128
129# Add $arch as supported with no additional flags.
130macro(add_default_target_arch arch)
131 set(TARGET_${arch}_CFLAGS "")
132 set(CAN_TARGET_${arch} 1)
133 list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
134endmacro()
135
136macro(detect_target_arch)
137 check_symbol_exists(__arm__ "" __ARM)
138 check_symbol_exists(__aarch64__ "" __AARCH64)
139 check_symbol_exists(__x86_64__ "" __X86_64)
140 check_symbol_exists(__i686__ "" __I686)
141 check_symbol_exists(__i386__ "" __I386)
142 check_symbol_exists(__mips__ "" __MIPS)
143 check_symbol_exists(__mips64__ "" __MIPS64)
144 if(__ARM)
145 add_default_target_arch(arm)
146 elseif(__AARCH64)
147 add_default_target_arch(aarch64)
148 elseif(__X86_64)
149 add_default_target_arch(x86_64)
150 elseif(__I686)
151 add_default_target_arch(i686)
152 elseif(__I386)
153 add_default_target_arch(i386)
154 elseif(__MIPS64) # must be checked before __MIPS
155 add_default_target_arch(mips64)
156 elseif(__MIPS)
157 add_default_target_arch(mips)
158 endif()
159endmacro()
160
Stephen Hines86277eb2015-03-23 12:06:32 -0700161# Detect whether the current target platform is 32-bit or 64-bit, and setup
162# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
163if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
164 NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
165 message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
166endif()
167
Stephen Hines6d186232014-11-26 17:56:19 -0800168# Generate the COMPILER_RT_SUPPORTED_ARCH list.
169if(ANDROID)
170 # Can't rely on LLVM_NATIVE_ARCH in cross-compilation.
171 # Examine compiler output instead.
172 detect_target_arch()
173 set(COMPILER_RT_OS_SUFFIX "-android")
174else()
175 if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
Stephen Hines86277eb2015-03-23 12:06:32 -0700176 if(NOT MSVC)
177 test_target_arch(x86_64 "" "-m64")
Pirama Arumuga Nainar7c915052015-04-08 08:58:29 -0700178 # FIXME: We build runtimes for both i686 and i386, as "clang -m32" may
179 # target different variant than "$CMAKE_C_COMPILER -m32". This part should
180 # be gone after we resolve PR14109.
Stephen Hines86277eb2015-03-23 12:06:32 -0700181 test_target_arch(i686 __i686__ "-m32")
Pirama Arumuga Nainar7c915052015-04-08 08:58:29 -0700182 test_target_arch(i386 __i386__ "-m32")
Stephen Hines86277eb2015-03-23 12:06:32 -0700183 else()
184 test_target_arch(i386 "" "")
Stephen Hines6d186232014-11-26 17:56:19 -0800185 endif()
Stephen Hines6d186232014-11-26 17:56:19 -0800186 elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
Stephen Hines86277eb2015-03-23 12:06:32 -0700187 TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
188 if(HOST_IS_BIG_ENDIAN)
189 test_target_arch(powerpc64 "" "-m64")
190 else()
191 test_target_arch(powerpc64le "" "-m64")
192 endif()
Stephen Hines6d186232014-11-26 17:56:19 -0800193 elseif("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700194 # Gcc doesn't accept -m32/-m64 so we do the next best thing and use
195 # -mips32r2/-mips64r2. We don't use -mips1/-mips3 because we want to match
196 # clang's default CPU's. In the 64-bit case, we must also specify the ABI
197 # since the default ABI differs between gcc and clang.
198 # FIXME: Ideally, we would build the N32 library too.
Stephen Hines6d186232014-11-26 17:56:19 -0800199 if("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "mipsel|mips64el")
200 # regex for mipsel, mips64el
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700201 test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
202 test_target_arch(mips64el "" "-mips64r2" "-mabi=n64")
Stephen Hines6d186232014-11-26 17:56:19 -0800203 else()
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700204 test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
205 test_target_arch(mips64 "" "-mips64r2" "-mabi=n64")
Stephen Hines6d186232014-11-26 17:56:19 -0800206 endif()
207 elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "arm")
Stephen Hines86277eb2015-03-23 12:06:32 -0700208 test_target_arch(arm "" "-march=armv7-a")
Stephen Hines6d186232014-11-26 17:56:19 -0800209 elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch32")
Stephen Hines86277eb2015-03-23 12:06:32 -0700210 test_target_arch(aarch32 "" "-march=armv8-a")
Stephen Hines6d186232014-11-26 17:56:19 -0800211 elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch64")
Stephen Hines86277eb2015-03-23 12:06:32 -0700212 test_target_arch(aarch64 "" "-march=armv8-a")
Stephen Hines6d186232014-11-26 17:56:19 -0800213 endif()
214 set(COMPILER_RT_OS_SUFFIX "")
215endif()
216
217message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")
218
219# Takes ${ARGN} and puts only supported architectures in @out_var list.
220function(filter_available_targets out_var)
221 set(archs)
222 foreach(arch ${ARGN})
223 list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
224 if(NOT (ARCH_INDEX EQUAL -1) AND CAN_TARGET_${arch})
225 list(APPEND archs ${arch})
226 endif()
227 endforeach()
228 set(${out_var} ${archs} PARENT_SCOPE)
229endfunction()
230
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700231# Returns a list of architecture specific target cflags in @out_var list.
Stephen Hines86277eb2015-03-23 12:06:32 -0700232function(get_target_flags_for_arch arch out_var)
233 list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
234 if(ARCH_INDEX EQUAL -1)
235 message(FATAL_ERROR "Unsupported architecture: ${arch}")
236 else()
237 set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE)
238 endif()
239endfunction()
240
241# Architectures supported by compiler-rt libraries.
Stephen Hines6d186232014-11-26 17:56:19 -0800242filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
243 x86_64 i386 i686 powerpc64 powerpc64le arm aarch64 mips mips64 mipsel mips64el)
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -0700244# LSan and UBSan common files should be available on all architectures supported
Stephen Hines6d186232014-11-26 17:56:19 -0800245# by other sanitizers (even if they build into dummy object files).
246filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
247 ${SANITIZER_COMMON_SUPPORTED_ARCH})
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -0700248filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH
249 ${SANITIZER_COMMON_SUPPORTED_ARCH})
Pirama Arumuga Nainar7c915052015-04-08 08:58:29 -0700250filter_available_targets(ASAN_SUPPORTED_ARCH
251 x86_64 i386 i686 powerpc64 powerpc64le arm mips mipsel mips64 mips64el)
252filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
253filter_available_targets(LSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
Stephen Hines6d186232014-11-26 17:56:19 -0800254filter_available_targets(MSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
255filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 i686 arm mips mips64
256 mipsel mips64el aarch64 powerpc64 powerpc64le)
Stephen Hines86277eb2015-03-23 12:06:32 -0700257filter_available_targets(TSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -0700258filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 i686 arm aarch64 mips
259 mipsel mips64 mips64el powerpc64 powerpc64le)
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700260filter_available_targets(SAFESTACK_SUPPORTED_ARCH x86_64 i386 i686)
Stephen Hines6d186232014-11-26 17:56:19 -0800261
262if(ANDROID)
263 set(OS_NAME "Android")
264else()
265 set(OS_NAME "${CMAKE_SYSTEM_NAME}")
266endif()
267
268if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
269 (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
270 (OS_NAME MATCHES "Windows" AND MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4)))
271 set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
272else()
273 set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)
274endif()
275
276if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH)
277 set(COMPILER_RT_HAS_ASAN TRUE)
278else()
279 set(COMPILER_RT_HAS_ASAN FALSE)
280endif()
281
Stephen Hines86277eb2015-03-23 12:06:32 -0700282if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
283 set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
284else()
285 set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
286endif()
287
Stephen Hines6d186232014-11-26 17:56:19 -0800288# TODO: Add builtins support.
289
290if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
291 OS_NAME MATCHES "Linux")
292 set(COMPILER_RT_HAS_DFSAN TRUE)
293else()
294 set(COMPILER_RT_HAS_DFSAN FALSE)
295endif()
296
297if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
298 OS_NAME MATCHES "Darwin|Linux|FreeBSD")
299 set(COMPILER_RT_HAS_LSAN TRUE)
300else()
301 set(COMPILER_RT_HAS_LSAN FALSE)
302endif()
303
Stephen Hines6d186232014-11-26 17:56:19 -0800304if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
305 OS_NAME MATCHES "Linux")
306 set(COMPILER_RT_HAS_MSAN TRUE)
307else()
308 set(COMPILER_RT_HAS_MSAN FALSE)
309endif()
310
311if (PROFILE_SUPPORTED_ARCH AND
312 OS_NAME MATCHES "Darwin|Linux|FreeBSD")
313 set(COMPILER_RT_HAS_PROFILE TRUE)
314else()
315 set(COMPILER_RT_HAS_PROFILE FALSE)
316endif()
317
318if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
319 OS_NAME MATCHES "Linux|FreeBSD")
320 set(COMPILER_RT_HAS_TSAN TRUE)
321else()
322 set(COMPILER_RT_HAS_TSAN FALSE)
323endif()
324
325if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
326 OS_NAME MATCHES "Darwin|Linux|FreeBSD")
327 set(COMPILER_RT_HAS_UBSAN TRUE)
328else()
329 set(COMPILER_RT_HAS_UBSAN FALSE)
330endif()
331
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -0700332# -msse3 flag is not valid for Mips therefore clang gives a warning
333# message with -msse3. But check_c_compiler_flags() checks only for
334# compiler error messages. Therefore COMPILER_RT_HAS_MSSE3_FLAG turns out to be
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700335# true on Mips, so we make it false here.
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -0700336if("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
337 set(COMPILER_RT_HAS_MSSE3_FLAG FALSE)
338endif()
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -0700339
340if (SAFESTACK_SUPPORTED_ARCH AND
341 OS_NAME MATCHES "Darwin|Linux|FreeBSD")
342 set(COMPILER_RT_HAS_SAFESTACK TRUE)
343else()
344 set(COMPILER_RT_HAS_SAFESTACK FALSE)
345endif()