Index: test/asan/CMakeLists.txt =================================================================== --- test/asan/CMakeLists.txt +++ test/asan/CMakeLists.txt @@ -41,7 +41,7 @@ darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH) endif() -foreach(arch ${ASAN_TEST_ARCH}) +macro(add_asan_testsuite arch lld thinlto) if(ANDROID) set(ASAN_TEST_TARGET_ARCH ${arch}-android) else() @@ -53,7 +53,19 @@ set(ASAN_TEST_IOSSIM "0") pythonize_bool(ASAN_TEST_IOSSIM) + set(ASAN_TEST_USE_THINLTO ${thinlto}) + set(ASAN_TEST_USE_LLD ${lld}) + string(TOLOWER "-${arch}-${OS_NAME}" ASAN_TEST_CONFIG_SUFFIX) + if (${thinlto}) + set(ASAN_TEST_CONFIG_SUFFIX "-thinlto${ASAN_TEST_CONFIG_SUFFIX}") + list(APPEND ASAN_TEST_DEPS LTO) + endif() + if (${lld}) + set(ASAN_TEST_CONFIG_SUFFIX "-lld${ASAN_TEST_CONFIG_SUFFIX}") + list(APPEND ASAN_TEST_DEPS lld) + endif() + get_bits_for_arch(${arch} ASAN_TEST_BITS) get_test_cc_for_arch(${arch} ASAN_TEST_TARGET_CC ASAN_TEST_TARGET_CFLAGS) if(ANDROID) @@ -63,6 +75,14 @@ endif() string(TOUPPER ${arch} ARCH_UPPER_CASE) set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config) + if (${thinlto}) + set(CONFIG_NAME "thinlto${CONFIG_NAME}") + list(APPEND MSAN_TEST_DEPS LTO) + endif() + if (${lld}) + set(CONFIG_NAME "LLD${CONFIG_NAME}") + list(APPEND MSAN_TEST_DEPS lld) + endif() configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg @@ -71,14 +91,39 @@ if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME) string(TOLOWER "-${arch}-${OS_NAME}-dynamic" ASAN_TEST_CONFIG_SUFFIX) + if (${thinlto}) + set(ASAN_TEST_CONFIG_SUFFIX "-thinlto${ASAN_TEST_CONFIG_SUFFIX}") + list(APPEND ASAN_TEST_DEPS LTO) + endif() + if (${lld}) + set(ASAN_TEST_CONFIG_SUFFIX "-lld${ASAN_TEST_CONFIG_SUFFIX}") + list(APPEND ASAN_TEST_DEPS lld) + endif() set(ASAN_TEST_DYNAMIC True) set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}DynamicConfig) + set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config) + if (${thinlto}) + set(CONFIG_NAME "thinlto${CONFIG_NAME}") + list(APPEND MSAN_TEST_DEPS LTO) + endif() + if (${lld}) + set(CONFIG_NAME "LLD${CONFIG_NAME}") + list(APPEND MSAN_TEST_DEPS lld) + endif() configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg) list(APPEND ASAN_DYNAMIC_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}) endif() +endmacro() + +foreach(arch ${ASAN_TEST_ARCH}) + add_asan_testsuite(${arch} False False) + + if(COMPILER_RT_HAS_LLD AND arch STREQUAL "x86_64" AND NOT (APPLE OR WIN32)) + add_asan_testsuite(${arch} True False) + endif() endforeach() # iOS and iOS simulator test suites @@ -93,6 +138,8 @@ set(ASAN_TEST_IOS "1") pythonize_bool(ASAN_TEST_IOS) set(ASAN_TEST_DYNAMIC True) + set(ASAN_TEST_USE_THINLTO FALSE) + set(ASAN_TEST_USE_LLD FALSE) foreach(arch ${DARWIN_iossim_ARCHS}) set(ASAN_TEST_IOSSIM "1") Index: test/asan/lit.site.cfg.in =================================================================== --- test/asan/lit.site.cfg.in +++ test/asan/lit.site.cfg.in @@ -9,6 +9,8 @@ config.iossim = @ASAN_TEST_IOSSIM_PYBOOL@ config.asan_dynamic = @ASAN_TEST_DYNAMIC@ config.target_arch = "@ASAN_TEST_TARGET_ARCH@" +config.use_lld = @ASAN_TEST_USE_LLD@ +config.use_thinlto = @ASAN_TEST_USE_THINLTO@ # Load common config for all compiler-rt lit tests. lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")