diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2012-09-07 18:08:02 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2012-09-07 18:08:02 +0000 |
| commit | 7ea4c2ccfb5351814ae8091e82c29bae79c30bca (patch) | |
| tree | ce1f410f8e99adb89e9e13cc8c17a444711bf019 /compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc | |
| parent | e2186ed6d9072d55e4647ed4bcf0bcb7c15c7c0f (diff) | |
| download | bcm5719-llvm-7ea4c2ccfb5351814ae8091e82c29bae79c30bca.tar.gz bcm5719-llvm-7ea4c2ccfb5351814ae8091e82c29bae79c30bca.zip | |
tsan: ignore destruction of global mutexes (causes a lot of non-interesting reports)
llvm-svn: 163400
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc')
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc index f6b55982db8..9d4c2487315 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc @@ -132,6 +132,10 @@ void InitializeShadowMemory() { DPrintf("stack %zx\n", (uptr)&shadow); } +static uptr g_tls_size; +static uptr g_data_start; +static uptr g_data_end; + #ifndef TSAN_GO static void CheckPIE() { // Ensure that the binary is indeed compiled with -pie. @@ -150,7 +154,26 @@ static void CheckPIE() { } } -static uptr g_tls_size; +static void InitDataSeg() { + MemoryMappingLayout proc_maps; + uptr start, end, offset; + char name[128]; + bool prev_is_data = false; + while (proc_maps.Next(&start, &end, &offset, name, ARRAY_SIZE(name))) { + DPrintf("%p-%p %p %s\n", start, end, offset, name); + bool is_data = offset != 0 && name[0] != 0; + bool is_bss = offset == 0 && name[0] == 0 && prev_is_data; + if (g_data_start == 0 && is_data) + g_data_start = start; + if (is_bss) + g_data_end = end; + prev_is_data = is_data; + } + DPrintf("guessed data_start=%p data_end=%p\n", g_data_start, g_data_end); + CHECK_LT(g_data_start, g_data_end); + CHECK_GE((uptr)&g_data_start, g_data_start); + CHECK_LT((uptr)&g_data_start, g_data_end); +} #ifdef __i386__ # define INTERNAL_FUNCTION __attribute__((regparm(3), stdcall)) @@ -187,6 +210,7 @@ const char *InitializePlatform() { #ifndef TSAN_GO CheckPIE(); g_tls_size = (uptr)InitTlsSize(); + InitDataSeg(); #endif return getenv("TSAN_OPTIONS"); } @@ -232,6 +256,9 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size, #endif } +bool IsGlobalVar(uptr addr) { + return g_data_start && addr >= g_data_start && addr < g_data_end; +} } // namespace __tsan |

