diff options
author | Ryan Prichard <rprichard@google.com> | 2021-06-09 20:22:37 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-06-09 20:22:37 +0000 |
commit | f73a312a368e719c3a7e7b333c8c69694f1daff6 (patch) | |
tree | e6c7a1503de028c6373fce0790cef398ac7b5b3f | |
parent | adef728daa7474a09b60d581296d6f8d904b493e (diff) | |
parent | 45ad00158cee28182b7338b963e38b97747d7924 (diff) | |
download | libcxxabi-f73a312a368e719c3a7e7b333c8c69694f1daff6.tar.gz |
cxa_guard: avoid sys/syscall.h and SYS_gettid am: 45ad00158candroid-s-beta-5android-s-beta-4android-s-beta-3android-s-beta-5android-s-beta-4
Original change: https://android-review.googlesource.com/c/platform/external/libcxxabi/+/1729852
Change-Id: I92ec45841ef5323667ac2cb8d1399887f65d57e4
-rw-r--r-- | src/cxa_guard_impl.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cxa_guard_impl.h b/src/cxa_guard_impl.h index 58c5dc5..552c454 100644 --- a/src/cxa_guard_impl.h +++ b/src/cxa_guard_impl.h @@ -41,7 +41,10 @@ #include "include/atomic_support.h" #include <unistd.h> #include <sys/types.h> -#if defined(__has_include) +// Android Trusty: sys/syscall.h tries to include bits/syscall.h, which is +// missing. Trusty seems to define _LIBCXXABI_HAS_NO_THREADS, and gettid isn't +// needed in that case, so skip sys/syscall.h. +#if defined(__has_include) && !defined(_LIBCXXABI_HAS_NO_THREADS) # if __has_include(<sys/syscall.h>) # include <sys/syscall.h> # endif @@ -113,7 +116,10 @@ uint32_t PlatformThreadID() { return static_cast<uint32_t>( pthread_mach_thread_np(std::__libcpp_thread_get_current_id())); } -#elif defined(SYS_gettid) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +#elif defined(SYS_gettid) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ + !defined(__BIONIC__) +// Bionic: Disable the SYS_gettid feature for now. Some processes on Android +// block SYS_gettid using seccomp. uint32_t PlatformThreadID() { static_assert(sizeof(pid_t) == sizeof(uint32_t), ""); return static_cast<uint32_t>(syscall(SYS_gettid)); |