diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2012-10-04 13:54:49 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2012-10-04 13:54:49 +0000 |
commit | 1bf56b76cf08ab19800cf5a30849277bf1e084d4 (patch) | |
tree | b57b6fef81bc57a7311ac56d3b82f26952a17408 | |
parent | e933c9fc831073560e8731ac5a5e8414549387b5 (diff) | |
download | compiler-rt-1bf56b76cf08ab19800cf5a30849277bf1e084d4.tar.gz |
tsan for Go: support mallocs before __tsan_init() (required to support cgo code)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@165229 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/tsan/go/tsan_go.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tsan/go/tsan_go.cc b/lib/tsan/go/tsan_go.cc index 77da9fe70..eca6cae4e 100644 --- a/lib/tsan/go/tsan_go.cc +++ b/lib/tsan/go/tsan_go.cc @@ -105,7 +105,7 @@ void __tsan_fini() { 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_func_exit(int goid) { 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); |