From: Kuba Mracek Date: Wed, 30 Nov 2016 00:46:04 +0000 (+0000) Subject: [asan] Allow re-exec in instrumented unit tests on Darwin (fix unit tests on macOS... X-Git-Tag: llvmorg-4.0.0-rc1~3391 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4edffbd28ca49233a03d1e59a313fc6db87d3422;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/compiler-rt/lib/asan/tests/asan_test_main.cc b/compiler-rt/lib/asan/tests/asan_test_main.cc index d4d6de77..1071d44 100644 --- a/compiler-rt/lib/asan/tests/asan_test_main.cc +++ b/compiler-rt/lib/asan/tests/asan_test_main.cc @@ -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";