diff options
author | Vy Nguyen <vyng@google.com> | 2020-11-03 16:10:35 -0800 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2020-11-04 00:51:18 -0800 |
commit | 707d69ff32309bf244552c1a8e7335bb7bbc951e (patch) | |
tree | 543bce4409331ac8f19e0ee11c85efcc79973568 | |
parent | 73b6cb67dcdad25317f130966f59c6d0399624f8 (diff) | |
download | llvm-707d69ff32309bf244552c1a8e7335bb7bbc951e.tar.gz |
Use LLD for Android compiler-rt
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D90720
-rw-r--r-- | compiler-rt/CMakeLists.txt | 11 | ||||
-rw-r--r-- | compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp | 3 | ||||
-rw-r--r-- | compiler-rt/test/lit.common.cfg.py | 12 | ||||
-rw-r--r-- | compiler-rt/test/lit.common.configured.in | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 1705a005caef..bb8b81e2d51f 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -597,7 +597,18 @@ else() 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 index 0d8bcdd1cb17..f6edc7032018 100644 --- 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 index 742da04fe059..dc616f914c6d 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -60,18 +60,6 @@ if config.asan_shadow_scale != '': 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 index 92eb8c58ca6b..626c847f25ba 100644 --- a/compiler-rt/test/lit.common.configured.in +++ b/compiler-rt/test/lit.common.configured.in @@ -35,7 +35,7 @@ set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min") 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) |