2015-02-26 07:07:32 +08:00
|
|
|
include(CMakePushCheckState)
|
2014-02-18 15:26:58 +08:00
|
|
|
include(CheckCXXCompilerFlag)
|
2014-03-04 21:28:21 +08:00
|
|
|
include(CheckLibraryExists)
|
2014-02-27 14:52:41 +08:00
|
|
|
include(CheckSymbolExists)
|
2015-02-10 09:42:44 +08:00
|
|
|
include(TestBigEndian)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2015-05-06 04:13:39 +08:00
|
|
|
function(check_linker_flag flag out_var)
|
|
|
|
cmake_push_check_state()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
|
|
|
|
check_cxx_compiler_flag("" ${out_var})
|
|
|
|
cmake_pop_check_state()
|
|
|
|
endfunction()
|
|
|
|
|
2014-02-18 15:26:58 +08:00
|
|
|
# CodeGen options.
|
|
|
|
check_cxx_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
|
2014-02-18 16:07:09 +08:00
|
|
|
check_cxx_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fno-exceptions COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)
|
|
|
|
check_cxx_compiler_flag(-funwind-tables COMPILER_RT_HAS_FUNWIND_TABLES_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fno-stack-protector COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
|
2014-02-18 15:52:40 +08:00
|
|
|
check_cxx_compiler_flag(-fno-rtti COMPILER_RT_HAS_FNO_RTTI_FLAG)
|
2014-02-18 16:07:09 +08:00
|
|
|
check_cxx_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
|
2014-03-18 20:49:22 +08:00
|
|
|
check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
|
2014-04-01 21:16:30 +08:00
|
|
|
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
|
2015-01-01 02:20:52 +08:00
|
|
|
check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
|
2015-02-03 04:37:25 +08:00
|
|
|
check_cxx_compiler_flag(-msse3 COMPILER_RT_HAS_MSSE3_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2014-02-18 15:52:40 +08:00
|
|
|
check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
|
|
|
|
check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
|
|
|
|
check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
|
|
|
|
|
|
|
|
# Debug info flags.
|
|
|
|
check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
|
|
|
|
check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
|
|
|
|
check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
|
2015-02-03 04:37:25 +08:00
|
|
|
|
2014-02-18 15:26:58 +08:00
|
|
|
# Warnings.
|
2014-03-06 20:25:02 +08:00
|
|
|
check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
|
2014-02-24 19:32:49 +08:00
|
|
|
check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wglobal-constructors" COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)
|
2014-11-14 05:19:53 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wc99-extensions" COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2014-03-13 19:31:10 +08:00
|
|
|
check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
|
2014-02-24 19:32:49 +08:00
|
|
|
check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
|
2014-10-24 04:39:58 +08:00
|
|
|
check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)
|
|
|
|
check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)
|
2014-08-26 20:33:00 +08:00
|
|
|
check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
|
2014-10-24 04:39:58 +08:00
|
|
|
check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)
|
2014-02-27 14:52:41 +08:00
|
|
|
|
|
|
|
# Symbols.
|
|
|
|
check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
|
2014-03-04 21:28:21 +08:00
|
|
|
|
|
|
|
# Libraries.
|
2014-08-22 20:26:34 +08:00
|
|
|
check_library_exists(c printf "" COMPILER_RT_HAS_LIBC)
|
2014-03-04 21:28:21 +08:00
|
|
|
check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
|
2014-08-22 20:26:34 +08:00
|
|
|
check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
|
2014-03-04 21:28:21 +08:00
|
|
|
check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
|
2014-08-22 20:26:34 +08:00
|
|
|
check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
|
2014-08-09 06:01:20 +08:00
|
|
|
|
2015-05-06 04:13:39 +08:00
|
|
|
# Linker flags.
|
|
|
|
if(ANDROID)
|
|
|
|
check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
|
|
|
|
endif()
|
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
# Architectures.
|
|
|
|
|
|
|
|
# List of all architectures we can target.
|
|
|
|
set(COMPILER_RT_SUPPORTED_ARCH)
|
|
|
|
|
|
|
|
# Try to compile a very simple source file to ensure we can target the given
|
|
|
|
# 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)
|
|
|
|
file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <limits>\nint main() {}\n")
|
|
|
|
|
2015-02-26 07:07:32 +08:00
|
|
|
function(check_compile_definition def argstring out_var)
|
|
|
|
if("${def}" STREQUAL "")
|
|
|
|
set(${out_var} TRUE PARENT_SCOPE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
cmake_push_check_state()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${argstring}")
|
|
|
|
check_symbol_exists(${def} "" ${out_var})
|
|
|
|
cmake_pop_check_state()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# test_target_arch(<arch> <def> <target flags...>)
|
|
|
|
# Checks if architecture is supported: runs host compiler with provided
|
|
|
|
# flags to verify that:
|
|
|
|
# 1) <def> is defined (if non-empty)
|
|
|
|
# 2) simple file can be successfully built.
|
|
|
|
# If successful, saves target flags for this architecture.
|
|
|
|
macro(test_target_arch arch def)
|
2014-08-09 06:01:20 +08:00
|
|
|
set(TARGET_${arch}_CFLAGS ${ARGN})
|
2015-02-26 07:07:32 +08:00
|
|
|
set(argstring "")
|
2014-08-21 01:12:58 +08:00
|
|
|
foreach(arg ${ARGN})
|
|
|
|
set(argstring "${argstring} ${arg}")
|
|
|
|
endforeach()
|
2015-02-26 07:07:32 +08:00
|
|
|
check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
|
|
|
|
if(NOT HAS_${arch}_DEF)
|
|
|
|
set(CAN_TARGET_${arch} FALSE)
|
|
|
|
else()
|
|
|
|
set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
|
|
|
|
try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
|
|
|
|
COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}"
|
|
|
|
OUTPUT_VARIABLE TARGET_${arch}_OUTPUT
|
|
|
|
CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}")
|
|
|
|
endif()
|
2014-08-09 06:01:20 +08:00
|
|
|
if(${CAN_TARGET_${arch}})
|
|
|
|
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
|
2014-09-29 21:18:55 +08:00
|
|
|
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "${arch}")
|
2014-08-09 06:01:20 +08:00
|
|
|
# Bail out if we cannot target the architecture we plan to test.
|
|
|
|
message(FATAL_ERROR "Cannot compile for ${arch}:\n${TARGET_${arch}_OUTPUT}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2014-09-29 21:18:55 +08:00
|
|
|
# Add $arch as supported with no additional flags.
|
|
|
|
macro(add_default_target_arch arch)
|
|
|
|
set(TARGET_${arch}_CFLAGS "")
|
|
|
|
set(CAN_TARGET_${arch} 1)
|
|
|
|
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(detect_target_arch)
|
|
|
|
check_symbol_exists(__arm__ "" __ARM)
|
|
|
|
check_symbol_exists(__aarch64__ "" __AARCH64)
|
|
|
|
check_symbol_exists(__x86_64__ "" __X86_64)
|
2014-10-01 20:55:06 +08:00
|
|
|
check_symbol_exists(__i686__ "" __I686)
|
2014-09-29 21:18:55 +08:00
|
|
|
check_symbol_exists(__i386__ "" __I386)
|
|
|
|
check_symbol_exists(__mips__ "" __MIPS)
|
|
|
|
check_symbol_exists(__mips64__ "" __MIPS64)
|
|
|
|
if(__ARM)
|
|
|
|
add_default_target_arch(arm)
|
|
|
|
elseif(__AARCH64)
|
|
|
|
add_default_target_arch(aarch64)
|
|
|
|
elseif(__X86_64)
|
|
|
|
add_default_target_arch(x86_64)
|
2014-10-01 20:55:06 +08:00
|
|
|
elseif(__I686)
|
|
|
|
add_default_target_arch(i686)
|
2014-09-29 21:18:55 +08:00
|
|
|
elseif(__I386)
|
|
|
|
add_default_target_arch(i386)
|
|
|
|
elseif(__MIPS64) # must be checked before __MIPS
|
|
|
|
add_default_target_arch(mips64)
|
|
|
|
elseif(__MIPS)
|
|
|
|
add_default_target_arch(mips)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2015-01-30 05:32:34 +08:00
|
|
|
# Detect whether the current target platform is 32-bit or 64-bit, and setup
|
|
|
|
# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
|
|
|
|
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
|
|
|
|
NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
|
|
|
|
endif()
|
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
# Generate the COMPILER_RT_SUPPORTED_ARCH list.
|
|
|
|
if(ANDROID)
|
2014-09-29 21:18:55 +08:00
|
|
|
# Can't rely on LLVM_NATIVE_ARCH in cross-compilation.
|
|
|
|
# Examine compiler output instead.
|
|
|
|
detect_target_arch()
|
|
|
|
set(COMPILER_RT_OS_SUFFIX "-android")
|
2014-08-09 06:01:20 +08:00
|
|
|
else()
|
|
|
|
if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
|
2015-01-30 05:32:34 +08:00
|
|
|
if(NOT MSVC)
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(x86_64 "" "-m64")
|
2015-02-27 08:07:04 +08:00
|
|
|
# FIXME: We build runtimes for both i686 and i386, as "clang -m32" may
|
|
|
|
# target different variant than "$CMAKE_C_COMPILER -m32". This part should
|
|
|
|
# be gone after we resolve PR14109.
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(i686 __i686__ "-m32")
|
2015-02-27 08:07:04 +08:00
|
|
|
test_target_arch(i386 __i386__ "-m32")
|
2015-01-30 05:32:34 +08:00
|
|
|
else()
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(i386 "" "")
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
|
2015-02-10 09:42:44 +08:00
|
|
|
TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
|
|
|
|
if(HOST_IS_BIG_ENDIAN)
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(powerpc64 "" "-m64")
|
2015-02-10 09:42:44 +08:00
|
|
|
else()
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(powerpc64le "" "-m64")
|
2015-02-10 09:42:44 +08:00
|
|
|
endif()
|
2014-08-09 06:01:20 +08:00
|
|
|
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
|
2015-04-20 20:44:01 +08:00
|
|
|
# Gcc doesn't accept -m32/-m64 so we do the next best thing and use
|
|
|
|
# -mips32r2/-mips64r2. We don't use -mips1/-mips3 because we want to match
|
|
|
|
# clang's default CPU's. In the 64-bit case, we must also specify the ABI
|
|
|
|
# since the default ABI differs between gcc and clang.
|
|
|
|
# FIXME: Ideally, we would build the N32 library too.
|
[Compiler-rt][MIPS][Profile] Adding support for MIPS32/64
Summary:
Changed cmake/config-ix.cmake to add support for different MIPS architectures: mips, mipsel, mips64, mips64el
In profile code there is no target based dependencies, so just enabling mips flag does the work.
Patch by Mohit Bhakkad
Reviewers: dsanders, void, petarj, kcc, samsonov
Reviewed By: samsonov
Subscribers: llvm-commits, farazs, kumarsukhani
Differential Revision: http://reviews.llvm.org/D4880
llvm-svn: 218866
2014-10-02 20:47:55 +08:00
|
|
|
if("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "mipsel|mips64el")
|
2014-11-13 02:23:16 +08:00
|
|
|
# regex for mipsel, mips64el
|
2015-04-20 20:44:01 +08:00
|
|
|
test_target_arch(mipsel "" "-mips32r2")
|
|
|
|
test_target_arch(mips64el "" "-mips64r2 -mabi=n64")
|
[Compiler-rt][MIPS][Profile] Adding support for MIPS32/64
Summary:
Changed cmake/config-ix.cmake to add support for different MIPS architectures: mips, mipsel, mips64, mips64el
In profile code there is no target based dependencies, so just enabling mips flag does the work.
Patch by Mohit Bhakkad
Reviewers: dsanders, void, petarj, kcc, samsonov
Reviewed By: samsonov
Subscribers: llvm-commits, farazs, kumarsukhani
Differential Revision: http://reviews.llvm.org/D4880
llvm-svn: 218866
2014-10-02 20:47:55 +08:00
|
|
|
else()
|
2015-04-20 20:44:01 +08:00
|
|
|
test_target_arch(mips "" "-mips32r2")
|
|
|
|
test_target_arch(mips64 "" "-mips64r2 -mabi=n64")
|
[Compiler-rt][MIPS][Profile] Adding support for MIPS32/64
Summary:
Changed cmake/config-ix.cmake to add support for different MIPS architectures: mips, mipsel, mips64, mips64el
In profile code there is no target based dependencies, so just enabling mips flag does the work.
Patch by Mohit Bhakkad
Reviewers: dsanders, void, petarj, kcc, samsonov
Reviewed By: samsonov
Subscribers: llvm-commits, farazs, kumarsukhani
Differential Revision: http://reviews.llvm.org/D4880
llvm-svn: 218866
2014-10-02 20:47:55 +08:00
|
|
|
endif()
|
2014-10-08 21:47:18 +08:00
|
|
|
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "arm")
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(arm "" "-march=armv7-a")
|
2014-10-08 21:47:18 +08:00
|
|
|
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch32")
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(aarch32 "" "-march=armv8-a")
|
2014-10-08 21:47:18 +08:00
|
|
|
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch64")
|
2015-02-26 07:07:32 +08:00
|
|
|
test_target_arch(aarch64 "" "-march=armv8-a")
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
2014-09-29 21:18:55 +08:00
|
|
|
set(COMPILER_RT_OS_SUFFIX "")
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2014-11-14 05:19:53 +08:00
|
|
|
message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")
|
2014-09-29 21:18:55 +08:00
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
# Takes ${ARGN} and puts only supported architectures in @out_var list.
|
|
|
|
function(filter_available_targets out_var)
|
|
|
|
set(archs)
|
|
|
|
foreach(arch ${ARGN})
|
|
|
|
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
|
|
|
|
if(NOT (ARCH_INDEX EQUAL -1) AND CAN_TARGET_${arch})
|
|
|
|
list(APPEND archs ${arch})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
set(${out_var} ${archs} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2015-01-30 05:32:34 +08:00
|
|
|
function(get_target_flags_for_arch arch out_var)
|
|
|
|
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
|
|
|
|
if(ARCH_INDEX EQUAL -1)
|
|
|
|
message(FATAL_ERROR "Unsupported architecture: ${arch}")
|
|
|
|
else()
|
|
|
|
set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2015-01-21 10:09:16 +08:00
|
|
|
# Architectures supported by compiler-rt libraries.
|
2014-08-09 06:01:20 +08:00
|
|
|
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
|
2014-11-06 00:35:23 +08:00
|
|
|
x86_64 i386 i686 powerpc64 powerpc64le arm aarch64 mips mips64 mipsel mips64el)
|
2015-04-02 06:42:36 +08:00
|
|
|
# LSan and UBSan common files should be available on all architectures supported
|
2014-08-12 03:57:56 +08:00
|
|
|
# by other sanitizers (even if they build into dummy object files).
|
|
|
|
filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
|
|
|
|
${SANITIZER_COMMON_SUPPORTED_ARCH})
|
2015-04-02 06:42:36 +08:00
|
|
|
filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH
|
|
|
|
${SANITIZER_COMMON_SUPPORTED_ARCH})
|
2015-03-26 07:26:49 +08:00
|
|
|
filter_available_targets(ASAN_SUPPORTED_ARCH
|
|
|
|
x86_64 i386 i686 powerpc64 powerpc64le arm mips mipsel mips64 mips64el)
|
|
|
|
filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
|
|
|
|
filter_available_targets(LSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
|
2014-11-20 05:42:33 +08:00
|
|
|
filter_available_targets(MSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
|
2014-11-13 17:24:32 +08:00
|
|
|
filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 i686 arm mips mips64
|
|
|
|
mipsel mips64el aarch64 powerpc64 powerpc64le)
|
2015-02-20 14:42:41 +08:00
|
|
|
filter_available_targets(TSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
|
2015-04-01 23:33:22 +08:00
|
|
|
filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 i686 arm aarch64 mips
|
|
|
|
mipsel mips64 mips64el powerpc64 powerpc64le)
|
2014-08-09 06:01:20 +08:00
|
|
|
|
|
|
|
if(ANDROID)
|
|
|
|
set(OS_NAME "Android")
|
|
|
|
else()
|
|
|
|
set(OS_NAME "${CMAKE_SYSTEM_NAME}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
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 AND CMAKE_SIZEOF_VOID_P EQUAL 4)))
|
|
|
|
set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH)
|
|
|
|
set(COMPILER_RT_HAS_ASAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_ASAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
2015-02-04 02:40:34 +08:00
|
|
|
if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
|
2014-12-18 07:14:01 +08:00
|
|
|
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
|
|
|
|
endif()
|
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
# TODO: Add builtins support.
|
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux")
|
|
|
|
set(COMPILER_RT_HAS_DFSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_DFSAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
|
|
|
set(COMPILER_RT_HAS_LSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_LSAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux")
|
|
|
|
set(COMPILER_RT_HAS_MSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_MSAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PROFILE_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
|
|
|
set(COMPILER_RT_HAS_PROFILE TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_PROFILE FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
|
2014-10-27 19:28:53 +08:00
|
|
|
OS_NAME MATCHES "Linux|FreeBSD")
|
2014-08-09 06:01:20 +08:00
|
|
|
set(COMPILER_RT_HAS_TSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_TSAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
|
|
|
set(COMPILER_RT_HAS_UBSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_UBSAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
2015-04-10 17:45:22 +08:00
|
|
|
# -msse3 flag is not valid for Mips therefore clang gives a warning
|
|
|
|
# message with -msse3. But check_c_compiler_flags() checks only for
|
|
|
|
# compiler error messages. Therefore COMPILER_RT_HAS_MSSE3_FLAG turns out to be
|
2015-04-17 18:14:16 +08:00
|
|
|
# true on Mips, so we make it false here.
|
2015-04-10 17:45:22 +08:00
|
|
|
if("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
|
|
|
|
set(COMPILER_RT_HAS_MSSE3_FLAG FALSE)
|
|
|
|
endif()
|