[PATCH] D14510: [tsan] Implement `IsGlobalVar` for Darwin

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 00:08:25 PST 2015


dvyukov added a comment.

IsGlobalData is used only to detect global mutexes.
We use so-called "linker initialized" mutexes as global vars so that they are not subject to initialization and exit races:
https://code.google.com/p/chromium/codesearch#search/&q=LINKER_INITIALIZED&sq=package:chromium&type=cs
But we failed to fit an additional bit into mutex state to explicitly track such mutexes, so now tsan just conservatively assumes that all mutexes are linked-initialized.

I guess we need only SECT_DATA/SECT_COMMON as a mutex cannot be in a const section.
This can also improve performance for some programs.

Also this all must be #ifndef SANITIZER_GO. In fact, whole IsGlobalVar function is not needed for Go.


http://reviews.llvm.org/D14510





More information about the llvm-commits mailing list