[asan] Allow re-exec in instrumented unit tests on Darwin (fix unit tests on macOS <=10.10)

This fixes https://llvm.org/bugs/show_bug.cgi?id=30285. On macOS 10.10 and lower, instrumented unit tests still need to be able to re-exec to make interceptors work.

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

llvm-svn: 288224
This commit is contained in:
Kuba Mracek 2016-11-30 00:46:04 +00:00
parent 86bd29afda
commit 4edffbd28c
1 changed files with 10 additions and 1 deletions

View File

@ -28,9 +28,18 @@ extern "C" const char* __asan_default_options() {
namespace __sanitizer {
bool ReexecDisabled() {
#if __has_feature(address_sanitizer) && SANITIZER_MAC
// Allow re-exec in instrumented unit tests on Darwin. Technically, we only
// need this for 10.10 and below, where re-exec is required for the
// interceptors to work, but to avoid duplicating the version detection logic,
// let's just allow re-exec for all Darwin versions. On newer OS versions,
// returning 'false' doesn't do anything anyway, because we don't re-exec.
return false;
#else
return true;
#endif
}
}
} // namespace __sanitizer
int main(int argc, char **argv) {
testing::GTEST_FLAG(death_test_style) = "threadsafe";