[llvm-commits] [compiler-rt] r165229 - /compiler-rt/trunk/lib/tsan/go/tsan_go.cc

Dmitry Vyukov dvyukov at google.com
Thu Oct 4 06:54:50 PDT 2012


Author: dvyukov
Date: Thu Oct  4 08:54:49 2012
New Revision: 165229

URL: http://llvm.org/viewvc/llvm-project?rev=165229&view=rev
Log:
tsan for Go: support mallocs before __tsan_init() (required to support cgo code)

Modified:
    compiler-rt/trunk/lib/tsan/go/tsan_go.cc

Modified: compiler-rt/trunk/lib/tsan/go/tsan_go.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/tsan_go.cc?rev=165229&r1=165228&r2=165229&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/tsan_go.cc (original)
+++ compiler-rt/trunk/lib/tsan/go/tsan_go.cc Thu Oct  4 08:54:49 2012
@@ -105,7 +105,7 @@
   thr->in_rtl++;
   int res = Finalize(thr);
   thr->in_rtl--;
-  exit(res);  
+  exit(res);
 }
 
 void __tsan_read(int goid, void *addr, void *pc) {
@@ -130,6 +130,8 @@
 
 void __tsan_malloc(int goid, void *p, uptr sz, void *pc) {
   ThreadState *thr = goroutines[goid];
+  if (thr == 0)  // probably before __tsan_init()
+    return;
   thr->in_rtl++;
   MemoryResetRange(thr, (uptr)pc, (uptr)p, sz);
   MemoryAccessRange(thr, (uptr)pc, (uptr)p, sz, true);





More information about the llvm-commits mailing list