diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -597,7 +597,18 @@ set(COMPILER_RT_HAS_LLD TRUE) endif() endif() + +if(ANDROID) + set(COMPILER_RT_HAS_LLD TRUE) + set(COMPILER_RT_TEST_USE_LLD TRUE) + append_list_if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG -fuse-ld=lld SANITIZER_COMMON_LINK_FLAGS) + append_list_if(COMPILER_RT_HAS_LLD -fuse-ld=lld COMPILER_RT_UNITTEST_LINK_FLAGS) + if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG) + set(COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT FALSE) + endif() +endif() pythonize_bool(COMPILER_RT_HAS_LLD) +pythonize_bool(COMPILER_RT_TEST_USE_LLD) add_subdirectory(lib) diff --git a/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp b/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp --- a/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp +++ b/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp @@ -3,7 +3,8 @@ // https://code.google.com/p/address-sanitizer/issues/detail?id=260 // REQUIRES: lld - +// FIXME: This may pass on Android, with non-emulated-tls. +// XFAIL: android int undefined(); // On i386 clang adds --export-dynamic when linking with ASan, which adds all diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -60,18 +60,6 @@ if config.memprof_shadow_scale != '': config.target_cflags += " -mllvm -memprof-mapping-scale=" + config.memprof_shadow_scale -# BFD linker in 64-bit android toolchains fails to find libc++_shared.so, which -# is a transitive shared library dependency (via asan runtime). -if config.android: - # Prepend the flag so that it can be overridden. - config.target_cflags = "-pie -fuse-ld=gold " + config.target_cflags - if config.android_ndk_version < 19: - # With a new compiler and NDK < r19 this flag ends up meaning "link against - # libc++", but NDK r19 makes this mean "link against the stub libstdc++ that - # just contains a handful of ABI functions", which makes most C++ code fail - # to link. In r19 and later we just use the default which is libc++. - config.cxx_mode_flags.append('-stdlib=libstdc++') - config.environment = dict(os.environ) # Clear some environment variables that might affect Clang. diff --git a/compiler-rt/test/lit.common.configured.in b/compiler-rt/test/lit.common.configured.in --- a/compiler-rt/test/lit.common.configured.in +++ b/compiler-rt/test/lit.common.configured.in @@ -35,7 +35,7 @@ set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@) set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@) set_default("can_symbolize", @CAN_SYMBOLIZE@) -set_default("use_lld", False) +set_default("use_lld", @COMPILER_RT_TEST_USE_LLD_PYBOOL@) set_default("use_thinlto", False) set_default("use_lto", config.use_thinlto) set_default("use_newpm", False)