[compiler-rt] a181799 - Fix lld detection in standalone compiler-rt.
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 14:46:58 PDT 2019
Author: Evgenii Stepanov
Date: 2019-10-24T14:46:10-07:00
New Revision: a1817996fa869acff181e5c8ea624020dcc1e88e
URL: https://github.com/llvm/llvm-project/commit/a1817996fa869acff181e5c8ea624020dcc1e88e
DIFF: https://github.com/llvm/llvm-project/commit/a1817996fa869acff181e5c8ea624020dcc1e88e.diff
LOG: 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
Added:
Modified:
compiler-rt/CMakeLists.txt
compiler-rt/cmake/config-ix.cmake
compiler-rt/test/hwasan/CMakeLists.txt
compiler-rt/test/msan/CMakeLists.txt
compiler-rt/test/ubsan/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 50d0eb0ed903..f8925ab2d76c 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -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)
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index a15fd485428a..ed071796f589 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -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)
diff --git a/compiler-rt/test/hwasan/CMakeLists.txt b/compiler-rt/test/hwasan/CMakeLists.txt
index 541604037e14..f6bdd510ad31 100644
--- a/compiler-rt/test/hwasan/CMakeLists.txt
+++ b/compiler-rt/test/hwasan/CMakeLists.txt
@@ -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()
diff --git a/compiler-rt/test/msan/CMakeLists.txt b/compiler-rt/test/msan/CMakeLists.txt
index 539f2d15663d..01b832b5ae3f 100644
--- a/compiler-rt/test/msan/CMakeLists.txt
+++ b/compiler-rt/test/msan/CMakeLists.txt
@@ -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})
diff --git a/compiler-rt/test/ubsan/CMakeLists.txt b/compiler-rt/test/ubsan/CMakeLists.txt
index 9f30718dd1cd..693f83291753 100644
--- a/compiler-rt/test/ubsan/CMakeLists.txt
+++ b/compiler-rt/test/ubsan/CMakeLists.txt
@@ -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)
More information about the llvm-commits
mailing list