our __csa_atexit does not like NULL dso; use atexit(3) instead.

This commit is contained in:
christos 2018-02-14 02:11:22 +00:00
parent be74da7a3a
commit d637e5b6a0
1 changed files with 11 additions and 0 deletions

View File

@ -705,10 +705,17 @@ INTERCEPTOR(long long, atoll, const char *nptr) { // NOLINT
}
#endif // ASAN_INTERCEPT_ATOLL_AND_STRTOLL
#ifdef SANITIZER_NETBSD
extern "C" void atexit(void (*)(void));
static void Atexit(void) {
StopInitOrderChecking();
}
#else
static void AtCxaAtexit(void *unused) {
(void)unused;
StopInitOrderChecking();
}
#endif
#if ASAN_INTERCEPT___CXA_ATEXIT
INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
@ -718,7 +725,11 @@ INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
#endif
ENSURE_ASAN_INITED();
int res = REAL(__cxa_atexit)(func, arg, dso_handle);
#ifdef SANITIZER_NETBSD
::atexit(Atexit);
#else
REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr);
#endif
return res;
}
#endif // ASAN_INTERCEPT___CXA_ATEXIT