summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_rtl.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-01-15 03:39:04 +0000
committerYabin Cui <yabinc@google.com>2016-01-15 03:39:04 +0000
commitb78f9c1f623e5faa4cca68227ab536ae80f9fc16 (patch)
treec81638069539a4f997403f1ccf3b895d2a2f8b96 /lib/tsan/rtl/tsan_rtl.h
parent1c8ea04c6d69b3240f26e8cd296e3d26af9bc554 (diff)
[tsan] Store the pointer to ThreadState in TLS slot on Android.
Summary: 1. Android doesn't support __thread keyword. So allocate ThreadState dynamically and store its pointer in one TLS slot provided by Android. 2. On Android, intercepted functions can be called before ThreadState is initialized. So add test of thr_->is_inited in some places. 3. On Android, intercepted functions can be called after ThreadState is destroyed. So add a fake dead_thread_state to represent all destroyed ThreadStates. And that is also why we don't store the pointer to ThreadState in shadow memory of pthread_self(). Reviewers: kcc, eugenis, dvyukov Subscribers: kubabrecka, llvm-commits, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D15301 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_rtl.h')
-rw-r--r--lib/tsan/rtl/tsan_rtl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tsan/rtl/tsan_rtl.h b/lib/tsan/rtl/tsan_rtl.h
index 04104b162..0b59a507c 100644
--- a/lib/tsan/rtl/tsan_rtl.h
+++ b/lib/tsan/rtl/tsan_rtl.h
@@ -411,7 +411,7 @@ struct ThreadState {
};
#ifndef SANITIZER_GO
-#if SANITIZER_MAC
+#if SANITIZER_MAC || SANITIZER_ANDROID
ThreadState *cur_thread();
void cur_thread_finalize();
#else
@@ -421,7 +421,7 @@ INLINE ThreadState *cur_thread() {
return reinterpret_cast<ThreadState *>(&cur_thread_placeholder);
}
INLINE void cur_thread_finalize() { }
-#endif // SANITIZER_MAC
+#endif // SANITIZER_MAC || SANITIZER_ANDROID
#endif // SANITIZER_GO
class ThreadContext : public ThreadContextBase {