[llvm-commits] [compiler-rt] r165004 - in /compiler-rt/trunk/lib: sanitizer_common/sanitizer_common.h sanitizer_common/sanitizer_linux.cc sanitizer_common/sanitizer_mac.cc sanitizer_common/sanitizer_posix.cc tsan/rtl/tsan_report.cc tsan/rtl/tsan_report.h tsan/rtl/tsan_rtl.h tsan/rtl/tsan_rtl_thread.cc

Dmitry Vyukov dvyukov at google.com
Tue Oct 2 05:58:14 PDT 2012


Author: dvyukov
Date: Tue Oct  2 07:58:14 2012
New Revision: 165004

URL: http://llvm.org/viewvc/llvm-project?rev=165004&view=rev
Log:
tsan: fix mac build

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Tue Oct  2 07:58:14 2012
@@ -34,7 +34,7 @@
 
 // Threads
 int GetPid();
-int GetTid();
+uptr GetTid();
 uptr GetThreadSelf();
 void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
                                 uptr *stack_bottom);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Tue Oct  2 07:58:14 2012
@@ -89,6 +89,10 @@
 }
 
 // ----------------- 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

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Tue Oct  2 07:58:14 2012
@@ -80,6 +80,10 @@
 }
 
 // ----------------- sanitizer_common.h
+uptr GetTid() {
+  return reinterpret_cast<uptr>(pthread_self());
+}
+
 void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
                                 uptr *stack_bottom) {
   CHECK(stack_top);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Tue Oct  2 07:58:14 2012
@@ -27,7 +27,6 @@
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#include <syscall.h>
 #include <unistd.h>
 
 namespace __sanitizer {
@@ -38,10 +37,6 @@
   return getpid();
 }
 
-int GetTid() {
-  return syscall(__NR_gettid);
-}
-
 uptr GetThreadSelf() {
   return (uptr)pthread_self();
 }

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Tue Oct  2 07:58:14 2012
@@ -104,7 +104,7 @@
   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");

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.h?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.h Tue Oct  2 07:58:14 2012
@@ -67,7 +67,7 @@
 
 struct ReportThread {
   int id;
-  int pid;
+  uptr pid;
   bool running;
   char *name;
   ReportStack *stack;

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Tue Oct  2 07:58:14 2012
@@ -327,7 +327,7 @@
 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 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);

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc?rev=165004&r1=165003&r2=165004&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc Tue Oct  2 07:58:14 2012
@@ -137,7 +137,7 @@
   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;





More information about the llvm-commits mailing list