[PATCH] [ASan] Make BlockingMutex really linker initialized.

Alexey Samsonov vonosmas at gmail.com
Thu Jan 29 15:59:29 PST 2015


Good point!


REPOSITORY
  rL LLVM

================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:501
@@ -504,2 +500,3 @@
 void BlockingMutex::Lock() {
+  CHECK_EQ(owner_, 0);
   atomic_uint32_t *m = reinterpret_cast<atomic_uint32_t *>(&opaque_storage_);
----------------
ygribov wrote:
> samsonov wrote:
> > owner_ isn't used in any other BlockingMutex functions on Linux. Let's just delete this line.
> Then the field would become unused causing build errors. And removing it just for Linux would cause more #ifdefs. BTW what's the reason for different treatment of owner_ on Linux and Mac? Looks like Mac check got strengthened at some point.
owner_ field was previously used on Linux, but BlockingMutex implementation was rewritten in r172380. I'd suggest to consistently use owner_ to store GetThreadSelf() on all platforms (we already do this on Mac and Windows).

http://reviews.llvm.org/D7171

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list