diff options
author | Kuba Mracek <mracek@apple.com> | 2017-04-21 17:18:14 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-04-21 17:18:14 +0000 |
commit | 0a039ecbdab95ae1274a6e0ec484c2a1c2419bdd (patch) | |
tree | 8d49670ce014215b41871aa11b33948d974f8fda /test/tsan/Darwin/external-ignore-noninstrumented.cc | |
parent | cc599619a08deaae432a0a62212de6cc7dca490d (diff) |
[tsan] Ignore memory accesses for libignored modules for "external" races
On Darwin, the setting ignore_noninstrumented_modules is used to suppress false positives in code that users don't have control of. The recently added "external" API (which can be used to detect races on objects provided by system libraries, but the race is actually user's fault) ignores this flag and it can report issues in non-instrumented modules. This patch fixes that.
Differential Revision: https://reviews.llvm.org/D31553
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/Darwin/external-ignore-noninstrumented.cc')
-rw-r--r-- | test/tsan/Darwin/external-ignore-noninstrumented.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/tsan/Darwin/external-ignore-noninstrumented.cc b/test/tsan/Darwin/external-ignore-noninstrumented.cc new file mode 100644 index 000000000..d2acaf54b --- /dev/null +++ b/test/tsan/Darwin/external-ignore-noninstrumented.cc @@ -0,0 +1,19 @@ +// RUN: %clangxx_tsan -shared %p/external-lib.cc -fno-sanitize=thread -DUSE_TSAN_CALLBACKS \ +// RUN: -o %t-lib.dylib -install_name @rpath/`basename %t-lib.dylib` + +// RUN: %clangxx_tsan -shared %p/external-noninstrumented-module.cc %t-lib.dylib -fno-sanitize=thread \ +// RUN: -o %t-module.dylib -install_name @rpath/`basename %t-module.dylib` + +// RUN: %clangxx_tsan %s %t-module.dylib -o %t +// RUN: %run %t 2>&1 | FileCheck %s + +#include <stdio.h> + +extern "C" void NonInstrumentedModule(); +int main(int argc, char *argv[]) { + NonInstrumentedModule(); + fprintf(stderr, "Done.\n"); +} + +// CHECK-NOT: WARNING: ThreadSanitizer +// CHECK: Done. |