Some functions of asan depends on `Atexit()` handlers. On Windows, this
is implemented in ad3ec82bb1 to queue the
handlers in a vector then register them with `atexit()` only after the
CRT is fully initialized. However, this is broken on MinGW with
asan_dynamic runtime due to different initialization order. This change
fixes the issue by making sure that `Atexit()` can call `atexit()`
directly past the pre-initialization phase.
This fixes two asan test cases on MinGW.
Differential Revision: https://reviews.llvm.org/D147413
19 lines
566 B
C++
19 lines
566 B
C++
// Make sure we report atexit stats.
|
|
// RUN: %clangxx_asan -O3 %s -o %t
|
|
// RUN: %env_asan_opts=atexit=1:print_stats=1 %run %t 2>&1 | FileCheck %s
|
|
//
|
|
// No atexit output in older versions of Android due to
|
|
// https://code.google.com/p/address-sanitizer/issues/detail?id=263
|
|
// UNSUPPORTED: android
|
|
|
|
#include <stdlib.h>
|
|
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
|
|
#include <malloc.h>
|
|
#endif
|
|
int *p1 = (int*)malloc(900);
|
|
int *p2 = (int*)malloc(90000);
|
|
int *p3 = (int*)malloc(9000000);
|
|
int main() { }
|
|
|
|
// CHECK: AddressSanitizer exit stats:
|