tsan: support linker init flag in __tsan_mutex_destroy
authorDmitry Vyukov <dvyukov@google.com>
Mon, 1 May 2017 10:01:13 +0000 (10:01 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Mon, 1 May 2017 10:01:13 +0000 (10:01 +0000)
commit5fa9175e24eaafadab71361dfe4f0f51b96ba4e9
tree698608e19caf3b5638a5a55d4c00c877c59a17c4
parent59e7fe3da8092e7dfb13376b959418bb507eaf87
tsan: support linker init flag in __tsan_mutex_destroy

For a linker init mutex with lazy flag setup
(no __tsan_mutex_create call), it is possible that
no lock/unlock happened before the destroy call.
Then when destroy runs we still don't know that
it is a linker init mutex and will emulate a memory write.
This in turn can lead to false positives as the mutex
is in fact linker initialized.

Support linker init flag in destroy annotation to resolve this.

llvm-svn: 301795
compiler-rt/include/sanitizer/tsan_interface.h
compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc
compiler-rt/lib/tsan/rtl/tsan_rtl.h
compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc