From 56faa551b9c5e5f0c26df6ca6cbd00a2a4ea5ccb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 2 Oct 2012 12:58:14 +0000 Subject: [PATCH] tsan: fix mac build llvm-svn: 165004 --- compiler-rt/lib/sanitizer_common/sanitizer_common.h | 2 +- compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 4 ++++ compiler-rt/lib/sanitizer_common/sanitizer_mac.cc | 4 ++++ compiler-rt/lib/sanitizer_common/sanitizer_posix.cc | 5 ----- compiler-rt/lib/tsan/rtl/tsan_report.cc | 2 +- compiler-rt/lib/tsan/rtl/tsan_report.h | 2 +- compiler-rt/lib/tsan/rtl/tsan_rtl.h | 4 ++-- compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index 04b08b7..323b066 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -34,7 +34,7 @@ const uptr kMmapGranularity = 1UL << 16; // Threads int GetPid(); -int GetTid(); +uptr GetTid(); uptr GetThreadSelf(); void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, uptr *stack_bottom); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index a280a8b..40f82c1 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -89,6 +89,10 @@ int internal_sched_yield() { } // ----------------- sanitizer_common.h +uptr GetTid() { + return syscall(__NR_gettid); +} + void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, uptr *stack_bottom) { static const uptr kMaxThreadStackSize = 256 * (1 << 20); // 256M diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc index 202c4f7..aaf95d5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc @@ -80,6 +80,10 @@ int internal_sched_yield() { } // ----------------- sanitizer_common.h +uptr GetTid() { + return reinterpret_cast(pthread_self()); +} + void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, uptr *stack_bottom) { CHECK(stack_top); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc index 7d21b5f..e3f8516 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include namespace __sanitizer { @@ -38,10 +37,6 @@ int GetPid() { return getpid(); } -int GetTid() { - return syscall(__NR_gettid); -} - uptr GetThreadSelf() { return (uptr)pthread_self(); } diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cc b/compiler-rt/lib/tsan/rtl/tsan_report.cc index ded8070..f24a4ec 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_report.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_report.cc @@ -104,7 +104,7 @@ static void PrintThread(const ReportThread *rt) { TsanPrintf(" Thread %d", rt->id); if (rt->name) TsanPrintf(" '%s'", rt->name); - TsanPrintf(" (tid=%d, %s)", rt->pid, rt->running ? "running" : "finished"); + TsanPrintf(" (tid=%zu, %s)", rt->pid, rt->running ? "running" : "finished"); if (rt->stack) TsanPrintf(" created at:"); TsanPrintf("\n"); diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.h b/compiler-rt/lib/tsan/rtl/tsan_report.h index 696e418..34dc88f 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_report.h +++ b/compiler-rt/lib/tsan/rtl/tsan_report.h @@ -67,7 +67,7 @@ struct ReportLocation { struct ReportThread { int id; - int pid; + uptr pid; bool running; char *name; ReportStack *stack; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h index f2b18e9..d2487ef 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h @@ -327,7 +327,7 @@ struct ThreadDeadInfo { struct ThreadContext { const int tid; int unique_id; // Non-rolling thread id. - int os_id; // pid + uptr os_id; // pid uptr user_id; // Some opaque user thread id (e.g. pthread_t). ThreadState *thr; ThreadStatus status; @@ -481,7 +481,7 @@ void FuncEntry(ThreadState *thr, uptr pc); void FuncExit(ThreadState *thr); int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached); -void ThreadStart(ThreadState *thr, int tid, int os_id); +void ThreadStart(ThreadState *thr, int tid, uptr os_id); void ThreadFinish(ThreadState *thr); int ThreadTid(ThreadState *thr, uptr pc, uptr uid); void ThreadJoin(ThreadState *thr, uptr pc, int tid); diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc index 47884b4..ee287cb 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc @@ -137,7 +137,7 @@ int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached) { return tid; } -void ThreadStart(ThreadState *thr, int tid, int os_id) { +void ThreadStart(ThreadState *thr, int tid, uptr os_id) { CHECK_GT(thr->in_rtl, 0); uptr stk_addr = 0; uptr stk_size = 0; -- 2.7.4