llvm-project/compiler-rt/lib/tsan
Dmitry Vyukov 9e2cd1c125 [tsan] Add Mutex annotation flag for constant-initialized __tsan_mutex_linker_init behavior
Add a new flag, _⁠_tsan_mutex_not_static, which has the opposite sense
of _⁠_tsan_mutex_linker_init. When the new _⁠_tsan_mutex_not_static flag
is passed to _⁠_tsan_mutex_destroy, tsan ignores the destruction unless
the mutex was also created with the _⁠_tsan_mutex_not_static flag.

This is useful for constructors that otherwise woud set
_⁠_tsan_mutex_linker_init but cannot, because they are declared constexpr.

Google has a custom mutex with two constructors, a "linker initialized"
constructor that relies on zero-initialization and sets
⁠_⁠_tsan_mutex_linker_init, and a normal one which sets no tsan flags.
The "linker initialized" constructor is morally constexpr, but we can't
declare it constexpr because of the need to call into tsan as a side effect.

With this new flag, the normal c'tor can set _⁠_tsan_mutex_not_static,
the "linker initialized" constructor can rely on tsan's lazy initialization,
and _⁠_tsan_mutex_destroy can still handle both cases correctly.

Author: Greg Falcon (gfalcon)
Reviewed in: https://reviews.llvm.org/D39095

llvm-svn: 316209
2017-10-20 12:08:53 +00:00
..
benchmarks
dd [sanitizer] Move cxx-abi library earlier in link flags. 2017-10-04 23:35:14 +00:00
go tsan: respect LDFLAGS when build Go test 2017-09-15 06:51:37 +00:00
rtl [tsan] Add Mutex annotation flag for constant-initialized __tsan_mutex_linker_init behavior 2017-10-20 12:08:53 +00:00
tests Disable TSan tests on Android. 2017-10-11 21:22:45 +00:00
.clang-format Tell clang-format that (most) sanitizers are written using Google style guide. 2015-11-19 22:11:10 +00:00
CMakeLists.txt Disable TSan tests on Android. 2017-10-11 21:22:45 +00:00
analyze_libtsan.sh [TSan] Slightly improve check_analyze script. 2015-12-07 20:18:50 +00:00
check_analyze.sh [TSan] Update test values 2017-08-18 19:22:39 +00:00
check_cmake.sh tsan: use a different dir for llvm build 2014-10-15 08:56:15 +00:00