[ASan] Rename asan_runtime_libraries to asan. Re-enable tests on Android.
llvm-svn: 201417
This commit is contained in:
parent
cbb2d5eee4
commit
9a70077b47
|
|
@ -69,7 +69,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build ASan runtimes shipped with Clang.
|
# Build ASan runtimes shipped with Clang.
|
||||||
set(ASAN_RUNTIME_LIBRARIES)
|
add_custom_target(asan)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
foreach (os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS})
|
foreach (os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS})
|
||||||
# Dynamic lookup is needed because shadow scale and offset are
|
# Dynamic lookup is needed because shadow scale and offset are
|
||||||
|
|
@ -85,7 +85,7 @@ if(APPLE)
|
||||||
CFLAGS ${ASAN_CFLAGS}
|
CFLAGS ${ASAN_CFLAGS}
|
||||||
DEFS ${ASAN_COMMON_DEFINITIONS}
|
DEFS ${ASAN_COMMON_DEFINITIONS}
|
||||||
LINKFLAGS ${ASAN_RUNTIME_LDFLAGS})
|
LINKFLAGS ${ASAN_RUNTIME_LDFLAGS})
|
||||||
list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan_${os}_dynamic)
|
add_dependencies(asan clang_rt.asan_${os}_dynamic)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
elseif(ANDROID)
|
elseif(ANDROID)
|
||||||
|
|
@ -98,7 +98,7 @@ elseif(ANDROID)
|
||||||
set_property(TARGET clang_rt.asan-arm-android APPEND PROPERTY
|
set_property(TARGET clang_rt.asan-arm-android APPEND PROPERTY
|
||||||
COMPILE_DEFINITIONS ${ASAN_COMMON_DEFINITIONS})
|
COMPILE_DEFINITIONS ${ASAN_COMMON_DEFINITIONS})
|
||||||
target_link_libraries(clang_rt.asan-arm-android dl log)
|
target_link_libraries(clang_rt.asan-arm-android dl log)
|
||||||
list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan-arm-android)
|
add_dependencies(asan clang_rt.asan-arm-android)
|
||||||
else()
|
else()
|
||||||
# Build separate libraries for each target.
|
# Build separate libraries for each target.
|
||||||
foreach(arch ${ASAN_SUPPORTED_ARCH})
|
foreach(arch ${ASAN_SUPPORTED_ARCH})
|
||||||
|
|
@ -116,10 +116,10 @@ else()
|
||||||
SOURCES ${ASAN_RUNTIME_OBJECTS}
|
SOURCES ${ASAN_RUNTIME_OBJECTS}
|
||||||
CFLAGS ${ASAN_CFLAGS}
|
CFLAGS ${ASAN_CFLAGS}
|
||||||
DEFS ${ASAN_COMMON_DEFINITIONS})
|
DEFS ${ASAN_COMMON_DEFINITIONS})
|
||||||
list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan-${arch})
|
add_dependencies(asan clang_rt.asan-${arch})
|
||||||
if (UNIX AND NOT ${arch} STREQUAL "i386")
|
if (UNIX AND NOT ${arch} STREQUAL "i386")
|
||||||
add_sanitizer_rt_symbols(clang_rt.asan-${arch} asan.syms.extra)
|
add_sanitizer_rt_symbols(clang_rt.asan-${arch} asan.syms.extra)
|
||||||
list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan-${arch}-symbols)
|
add_dependencies(asan clang_rt.asan-${arch}-symbols)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
@ -127,16 +127,13 @@ else()
|
||||||
SOURCES asan_dll_thunk.cc
|
SOURCES asan_dll_thunk.cc
|
||||||
CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK
|
CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK
|
||||||
DEFS ${ASAN_COMMON_DEFINITIONS})
|
DEFS ${ASAN_COMMON_DEFINITIONS})
|
||||||
list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan_dll_thunk-${arch})
|
add_dependencies(asan clang_rt.asan_dll_thunk-${arch})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compiler_rt_resource_file(asan_blacklist asan_blacklist.txt)
|
add_compiler_rt_resource_file(asan_blacklist asan_blacklist.txt)
|
||||||
|
add_dependencies(asan asan_blacklist)
|
||||||
# All ASan runtime dependencies.
|
|
||||||
add_custom_target(asan_runtime_libraries
|
|
||||||
DEPENDS asan_blacklist ${ASAN_RUNTIME_LIBRARIES})
|
|
||||||
|
|
||||||
if(LLVM_INCLUDE_TESTS)
|
if(LLVM_INCLUDE_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ macro(asan_compile obj_list source arch)
|
||||||
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
|
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
|
||||||
clang_compile(${output_obj} ${source}
|
clang_compile(${output_obj} ${source}
|
||||||
CFLAGS ${ARGN} ${TARGET_CFLAGS}
|
CFLAGS ${ARGN} ${TARGET_CFLAGS}
|
||||||
DEPS gtest asan_runtime_libraries
|
DEPS gtest asan
|
||||||
${ASAN_UNITTEST_HEADERS}
|
${ASAN_UNITTEST_HEADERS}
|
||||||
${ASAN_BLACKLIST_FILE})
|
${ASAN_BLACKLIST_FILE})
|
||||||
list(APPEND ${obj_list} ${output_obj})
|
list(APPEND ${obj_list} ${output_obj})
|
||||||
|
|
@ -98,7 +98,7 @@ endmacro()
|
||||||
macro(add_asan_test test_suite test_name arch)
|
macro(add_asan_test test_suite test_name arch)
|
||||||
parse_arguments(TEST "OBJECTS;LINKFLAGS" "WITH_TEST_RUNTIME" ${ARGN})
|
parse_arguments(TEST "OBJECTS;LINKFLAGS" "WITH_TEST_RUNTIME" ${ARGN})
|
||||||
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
|
get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
|
||||||
set(TEST_DEPS asan_runtime_libraries ${TEST_OBJECTS})
|
set(TEST_DEPS asan ${TEST_OBJECTS})
|
||||||
if(TEST_WITH_TEST_RUNTIME)
|
if(TEST_WITH_TEST_RUNTIME)
|
||||||
list(APPEND TEST_DEPS ${ASAN_TEST_RUNTIME})
|
list(APPEND TEST_DEPS ${ASAN_TEST_RUNTIME})
|
||||||
list(APPEND TEST_OBJECTS lib${ASAN_TEST_RUNTIME}.a)
|
list(APPEND TEST_OBJECTS lib${ASAN_TEST_RUNTIME}.a)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ configure_lit_site_cfg(
|
||||||
# Run sanitizer tests only if we're sure that clang would produce
|
# Run sanitizer tests only if we're sure that clang would produce
|
||||||
# working binaries.
|
# working binaries.
|
||||||
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
||||||
if(ASAN_SUPPORTED_ARCH)
|
if(ASAN_SUPPORTED_ARCH OR ANDROID)
|
||||||
add_subdirectory(asan)
|
add_subdirectory(asan)
|
||||||
endif()
|
endif()
|
||||||
if(DFSAN_SUPPORTED_ARCH)
|
if(DFSAN_SUPPORTED_ARCH)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ endif()
|
||||||
# Run ASan tests only if we're sure we may produce working binaries.
|
# Run ASan tests only if we're sure we may produce working binaries.
|
||||||
set(ASAN_TEST_DEPS
|
set(ASAN_TEST_DEPS
|
||||||
${SANITIZER_COMMON_LIT_TEST_DEPS}
|
${SANITIZER_COMMON_LIT_TEST_DEPS}
|
||||||
asan_runtime_libraries)
|
asan)
|
||||||
set(ASAN_TEST_PARAMS
|
set(ASAN_TEST_PARAMS
|
||||||
asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
||||||
# FIXME: support unit test in the android test runner
|
# FIXME: support unit test in the android test runner
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ if(NOT APPLE AND NOT ANDROID)
|
||||||
set(LSAN_TEST_DEPS
|
set(LSAN_TEST_DEPS
|
||||||
${SANITIZER_COMMON_LIT_TEST_DEPS}
|
${SANITIZER_COMMON_LIT_TEST_DEPS}
|
||||||
lsan
|
lsan
|
||||||
asan_runtime_libraries)
|
asan)
|
||||||
add_lit_testsuite(check-lsan "Running the LeakSanitizer tests"
|
add_lit_testsuite(check-lsan "Running the LeakSanitizer tests"
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/LsanConfig
|
${CMAKE_CURRENT_BINARY_DIR}/LsanConfig
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
|
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ configure_lit_site_cfg(
|
||||||
set(UBSAN_TEST_DEPS
|
set(UBSAN_TEST_DEPS
|
||||||
${SANITIZER_COMMON_LIT_TEST_DEPS}
|
${SANITIZER_COMMON_LIT_TEST_DEPS}
|
||||||
ubsan
|
ubsan
|
||||||
asan_runtime_libraries)
|
asan)
|
||||||
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
|
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig
|
${CMAKE_CURRENT_BINARY_DIR}/UbsanConfig
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
|
${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue