diff options
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | 5 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 7 |
2 files changed, 5 insertions, 7 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h index e18c89e5a63..ac2b0cf8024 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -178,12 +178,7 @@ typedef u32 operator_new_size_type; # endif #endif -#if SANITIZER_MAC -// On Darwin, thread IDs are 64-bit even on 32-bit systems. typedef u64 tid_t; -#else -typedef uptr tid_t; -#endif // ----------- ATTENTION ------------- // This header should NOT include any other headers to avoid portability issues. diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index c4352f99378..131f2b775e2 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -84,6 +84,7 @@ extern "C" { // FreeBSD 9.2 and 10.0. #include <sys/umtx.h> } +#include <sys/thr.h> extern char **environ; // provided by crt1 #endif // SANITIZER_FREEBSD @@ -453,11 +454,13 @@ bool FileExists(const char *filename) { tid_t GetTid() { #if SANITIZER_FREEBSD - return (uptr)pthread_self(); + long Tid; + thr_self(&Tid); + return Tid; #elif SANITIZER_NETBSD return _lwp_self(); #elif SANITIZER_SOLARIS - return (uptr)thr_self(); + return thr_self(); #else return internal_syscall(SYSCALL(gettid)); #endif |