diff options
Diffstat (limited to 'compiler-rt/lib/asan/asan_rtl.cc')
| -rw-r--r-- | compiler-rt/lib/asan/asan_rtl.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index 5fa4d65129d..41fbe6a4413 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -27,10 +27,9 @@ #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_symbolizer.h" -namespace __sanitizer { -using namespace __asan; +namespace __asan { -void Die() { +static void AsanDie() { static atomic_uint32_t num_calls; if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) { // Don't die twice - run a busy loop. @@ -49,8 +48,8 @@ void Die() { Exit(flags()->exitcode); } -SANITIZER_INTERFACE_ATTRIBUTE -void CheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) { +static void AsanCheckFailed(const char *file, int line, const char *cond, + u64 v1, u64 v2) { Report("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n", file, line, cond, (uptr)v1, (uptr)v2); // FIXME: check for infinite recursion without a thread-local counter here. @@ -58,10 +57,6 @@ void CheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) { ShowStatsAndAbort(); } -} // namespace __sanitizer - -namespace __asan { - // -------------------------- Flags ------------------------- {{{1 static const int kDeafultMallocContextSize = 30; @@ -291,6 +286,9 @@ void __asan_init() { // Make sure we are not statically linked. AsanDoesNotSupportStaticLinkage(); + // Install tool-specific callbacks in sanitizer_common. + SetDieCallback(AsanDie); + SetCheckFailedCallback(AsanCheckFailed); SetPrintfAndReportCallback(AppendToErrorMessageBuffer); // Initialize flags. This must be done early, because most of the |

