[sanitizer] On OS X, verify that interceptors work and abort if not
authorKuba Brecka <kuba.brecka@gmail.com>
Tue, 15 Mar 2016 14:30:28 +0000 (14:30 +0000)
committerKuba Brecka <kuba.brecka@gmail.com>
Tue, 15 Mar 2016 14:30:28 +0000 (14:30 +0000)
commit69b5943a055eb25b8740ecd984ac02d4ec51855c
tree734136b056770f1ecfb6597da4b7303740549f5f
parent96f4b128800cc567a4355025963ea64caa750904
[sanitizer] On OS X, verify that interceptors work and abort if not

On OS X 10.11+, we have "automatic interceptors", so we don't need to use DYLD_INSERT_LIBRARIES when launching instrumented programs. However, non-instrumented programs that load TSan late (e.g. via dlopen) are currently broken, as TSan will still try to initialize, but the program will crash/hang at random places (because the interceptors don't work). This patch adds an explicit check that interceptors are working, and if not, it aborts and prints out an error message suggesting to explicitly use DYLD_INSERT_LIBRARIES.

Differential Revision: http://reviews.llvm.org/D18121

llvm-svn: 263551
compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
compiler-rt/test/lit.common.cfg
compiler-rt/test/tsan/Darwin/dlopen.cc [new file with mode: 0644]