Skip to content

Commit 707d69f

Browse files
oontvoovitalybuka
authored andcommitted
Use LLD for Android compiler-rt
Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D90720
1 parent 73b6cb6 commit 707d69f

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,18 @@ else()
597597
set(COMPILER_RT_HAS_LLD TRUE)
598598
endif()
599599
endif()
600+
601+
if(ANDROID)
602+
set(COMPILER_RT_HAS_LLD TRUE)
603+
set(COMPILER_RT_TEST_USE_LLD TRUE)
604+
append_list_if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG -fuse-ld=lld SANITIZER_COMMON_LINK_FLAGS)
605+
append_list_if(COMPILER_RT_HAS_LLD -fuse-ld=lld COMPILER_RT_UNITTEST_LINK_FLAGS)
606+
if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
607+
set(COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT FALSE)
608+
endif()
609+
endif()
600610
pythonize_bool(COMPILER_RT_HAS_LLD)
611+
pythonize_bool(COMPILER_RT_TEST_USE_LLD)
601612

602613
add_subdirectory(lib)
603614

compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
// https://code.google.com/p/address-sanitizer/issues/detail?id=260
55
// REQUIRES: lld
6-
6+
// FIXME: This may pass on Android, with non-emulated-tls.
7+
// XFAIL: android
78
int undefined();
89

910
// On i386 clang adds --export-dynamic when linking with ASan, which adds all

compiler-rt/test/lit.common.cfg.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@
6060
if config.memprof_shadow_scale != '':
6161
config.target_cflags += " -mllvm -memprof-mapping-scale=" + config.memprof_shadow_scale
6262

63-
# BFD linker in 64-bit android toolchains fails to find libc++_shared.so, which
64-
# is a transitive shared library dependency (via asan runtime).
65-
if config.android:
66-
# Prepend the flag so that it can be overridden.
67-
config.target_cflags = "-pie -fuse-ld=gold " + config.target_cflags
68-
if config.android_ndk_version < 19:
69-
# With a new compiler and NDK < r19 this flag ends up meaning "link against
70-
# libc++", but NDK r19 makes this mean "link against the stub libstdc++ that
71-
# just contains a handful of ABI functions", which makes most C++ code fail
72-
# to link. In r19 and later we just use the default which is libc++.
73-
config.cxx_mode_flags.append('-stdlib=libstdc++')
74-
7563
config.environment = dict(os.environ)
7664

7765
# Clear some environment variables that might affect Clang.

compiler-rt/test/lit.common.configured.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min")
3535
set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
3636
set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
3737
set_default("can_symbolize", @CAN_SYMBOLIZE@)
38-
set_default("use_lld", False)
38+
set_default("use_lld", @COMPILER_RT_TEST_USE_LLD_PYBOOL@)
3939
set_default("use_thinlto", False)
4040
set_default("use_lto", config.use_thinlto)
4141
set_default("use_newpm", False)

0 commit comments

Comments
 (0)