[tsan] Add interceptors for objc_sync_enter and objc_sync_exit
authorKuba Mracek <mracek@apple.com>
Fri, 13 Apr 2018 01:05:29 +0000 (01:05 +0000)
committerKuba Mracek <mracek@apple.com>
Fri, 13 Apr 2018 01:05:29 +0000 (01:05 +0000)
commit296ce3bd23ba887f88e42cd17233cd6c62d36c90
tree17168b26d7ed7ad09c96a8554164931383a1ef3c
parent223f4c7c99c49467181b2228a3bb4734368ed3cf
[tsan] Add interceptors for objc_sync_enter and objc_sync_exit

Objective-C's @synchronize synchronization primitive uses calls to objc_sync_enter and objc_sync_exit runtime functions. In most cases, they end up just calling pthread_mutex_lock/pthread_mutex_unlock, but there are some cases where the synchronization from pthread_mutex_lock/pthread_mutex_unlock interceptors isn't enough. Let's add explicit interceptors for objc_sync_enter and objc_sync_exit to handle all cases.

Differential Revision: https://reviews.llvm.org/D45487

llvm-svn: 329982
compiler-rt/lib/tsan/CMakeLists.txt
compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cc
compiler-rt/test/tsan/Darwin/objc-synchronize.mm [new file with mode: 0644]