Fix lld detection in standalone compiler-rt.

Summary:
Right now all hwasan tests on Android are silently disabled because they
require "has_lld" and standalone compiler-rt can not (and AFAIK was
never able to) set it.

Reviewers: pcc

Subscribers: dberris, mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D69405
This commit is contained in:
Evgenii Stepanov 2019-10-24 13:14:03 -07:00
parent 55c223a7ed
commit a1817996fa
5 changed files with 11 additions and 4 deletions

View File

@ -497,7 +497,7 @@ else()
if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
set(COMPILER_RT_HAS_LLD TRUE)
else()
set(COMPILER_RT_HAS_LLD FALSE)
set(COMPILER_RT_HAS_LLD ${COMPILER_RT_HAS_FUSE_LD_LLD_FLAG})
endif()
endif()
pythonize_bool(COMPILER_RT_HAS_LLD)

View File

@ -146,6 +146,7 @@ check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
# Linker flags.
check_linker_flag("-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
check_linker_flag("-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
if(ANDROID)
check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)

View File

@ -24,7 +24,9 @@ set(HWASAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND HWASAN_TEST_DEPS hwasan)
if(COMPILER_RT_HAS_LLD)
list(APPEND HWASAN_TEST_DEPS lld)
if (TARGET lld)
list(APPEND HWASAN_TEST_DEPS lld)
endif()
endif()
endif()

View File

@ -20,7 +20,9 @@ macro(add_msan_testsuite arch lld thinlto)
endif()
if (${lld})
set(CONFIG_NAME "lld-${CONFIG_NAME}")
list(APPEND MSAN_TEST_DEPS lld)
if (TARGET lld)
list(APPEND MSAN_TEST_DEPS lld)
endif()
endif()
set(MSAN_TEST_USE_THINLTO ${thinlto})
set(MSAN_TEST_USE_LLD ${lld})

View File

@ -8,7 +8,9 @@ macro(add_ubsan_testsuite test_mode sanitizer arch lld thinlto)
set(CONFIG_NAME ${UBSAN_LIT_TEST_MODE})
if (${lld})
set(CONFIG_NAME ${CONFIG_NAME}-lld)
list(APPEND UBSAN_TEST_DEPS lld)
if (TARGET lld)
list(APPEND UBSAN_TEST_DEPS lld)
endif()
endif()
if (${thinlto})
set(CONFIG_NAME ${CONFIG_NAME}-thinlto)