Skip to content

Commit 76b1a7c

Browse files
authored
[libc++][Android] Explicitly declare low-level lib existence (#70534)
Android's librt and libpthread functionality is part of libc.{a,so} instead. The atomic APIs are part of the compiler-rt builtins archive. Android does have libdl. Android's libc.so has `__cxa_thread_atexit_impl` starting in API 23, and the oldest supported API is 21, so continue using feature detection for that API. These settings need to be declared explicitly for the sake of the fuzzer library's custom libc++ build `add_custom_libcxx`. That macro builds libc++ using `-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY`, which breaks the feature detection.
1 parent 32e35b2 commit 76b1a7c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

libcxx/cmake/config-ix.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ elseif(FUCHSIA)
107107
set(LIBCXX_HAS_PTHREAD_LIB NO)
108108
set(LIBCXX_HAS_RT_LIB NO)
109109
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
110+
elseif(ANDROID)
111+
set(LIBCXX_HAS_PTHREAD_LIB NO)
112+
set(LIBCXX_HAS_RT_LIB NO)
113+
set(LIBCXX_HAS_ATOMIC_LIB NO)
110114
else()
111115
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
112116
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)

libcxxabi/cmake/config-ix.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ if(FUCHSIA)
9595
set(LIBCXXABI_HAS_PTHREAD_LIB NO)
9696
check_library_exists(c __cxa_thread_atexit_impl ""
9797
LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
98+
elseif(ANDROID)
99+
set(LIBCXXABI_HAS_DL_LIB YES)
100+
set(LIBCXXABI_HAS_PTHREAD_LIB NO)
101+
check_library_exists(c __cxa_thread_atexit_impl ""
102+
LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
98103
else()
99104
check_library_exists(dl dladdr "" LIBCXXABI_HAS_DL_LIB)
100105
check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)

0 commit comments

Comments
 (0)