forked from OSchip/llvm-project
light up sanitizers for ARM
You can expect the sanitizers to be built under any of the following conditions: 1) CMAKE_C_COMPILER is GCC built to cross-compile to ARM 2) CMAKE_C_COMPILER is Clang built to cross-compile to ARM (ARM is default target) 3) CMAKE_C_COMPILER is Clang and CMAKE_C_FLAGS contains -target and --sysroot Differential Revision: http://reviews.llvm.org/D3794 llvm-svn: 209835
This commit is contained in:
parent
a02e66499b
commit
32685ec5fd
|
@ -215,9 +215,9 @@ else()
|
|||
test_target_arch(i386 ${TARGET_32_BIT_CFLAGS})
|
||||
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
|
||||
test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS})
|
||||
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "ARM")
|
||||
test_target_arch(arm "")
|
||||
endif()
|
||||
test_target_arch(arm "-march=armv7-a")
|
||||
test_target_arch(aarch64 "-march=armv8-a")
|
||||
endif()
|
||||
|
||||
# We support running instrumented tests when we're not cross compiling
|
||||
|
@ -347,14 +347,14 @@ endif()
|
|||
# Architectures supported by Sanitizer runtimes. Specific sanitizers may
|
||||
# support only subset of these (e.g. TSan works on x86_64 only).
|
||||
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
|
||||
x86_64 i386 powerpc64 arm)
|
||||
filter_available_targets(ASAN_SUPPORTED_ARCH x86_64 i386 powerpc64)
|
||||
x86_64 i386 powerpc64 arm aarch64)
|
||||
filter_available_targets(ASAN_SUPPORTED_ARCH x86_64 i386 powerpc64 arm)
|
||||
filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64)
|
||||
filter_available_targets(LSAN_SUPPORTED_ARCH x86_64)
|
||||
filter_available_targets(MSAN_SUPPORTED_ARCH x86_64)
|
||||
filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 arm)
|
||||
filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 arm aarch64)
|
||||
filter_available_targets(TSAN_SUPPORTED_ARCH x86_64)
|
||||
filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386)
|
||||
filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 arm aarch64)
|
||||
|
||||
add_subdirectory(include)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|||
# The common files need to build on every arch supported by ASan.
|
||||
# (Even if they build into dummy object files.)
|
||||
filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
|
||||
x86_64 i386 powerpc64 arm)
|
||||
x86_64 i386 powerpc64 arm aarch64)
|
||||
|
||||
add_custom_target(lsan)
|
||||
|
||||
|
|
|
@ -34,6 +34,21 @@ if(CAN_TARGET_arm)
|
|||
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/ARMLinuxConfig)
|
||||
endif()
|
||||
|
||||
if(CAN_TARGET_aarch64)
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(ASAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
||||
set(ASAN_TEST_CONFIG_SUFFIX "-aarch64-linux")
|
||||
set(ASAN_TEST_BITS "64")
|
||||
set(ASAN_TEST_DYNAMIC False)
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AArch64LinuxConfig/lit.site.cfg
|
||||
)
|
||||
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/AArch64LinuxConfig)
|
||||
endif()
|
||||
|
||||
if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64)
|
||||
set(ASAN_TEST_CONFIG_SUFFIX "64")
|
||||
set(ASAN_TEST_BITS "64")
|
||||
|
|
|
@ -4,11 +4,15 @@ set(UBSAN_LIT_TEST_MODE "Standalone")
|
|||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig/lit.site.cfg)
|
||||
set(UBSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig)
|
||||
|
||||
set(UBSAN_LIT_TEST_MODE "AddressSanitizer")
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig/lit.site.cfg)
|
||||
if(ASAN_SUPPORTED_ARCH)
|
||||
set(UBSAN_LIT_TEST_MODE "AddressSanitizer")
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig/lit.site.cfg)
|
||||
list(APPEND UBSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig)
|
||||
endif()
|
||||
|
||||
set(UBSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
|
||||
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
||||
|
@ -16,7 +20,6 @@ if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|||
endif()
|
||||
|
||||
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
|
||||
${UBSAN_TESTSUITES}
|
||||
DEPENDS ${UBSAN_TEST_DEPS})
|
||||
set_target_properties(check-ubsan PROPERTIES FOLDER "UBSan unittests")
|
||||
|
|
Loading…
Reference in New Issue