diff options
author | Kostya Serebryany <kcc@google.com> | 2013-10-18 07:57:59 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-10-18 07:57:59 +0000 |
commit | a2e70d92b67703effb631d7b4db8979fd74d5db5 (patch) | |
tree | cdf5fd1acceda82d250b4170f486a26961668470 | |
parent | 0c46cdebe103e5745a3b7be0b8c9c454a06bcccb (diff) | |
download | compiler-rt-a2e70d92b67703effb631d7b4db8979fd74d5db5.tar.gz compiler-rt-a2e70d92b67703effb631d7b4db8979fd74d5db5.tar.bz2 compiler-rt-a2e70d92b67703effb631d7b4db8979fd74d5db5.tar.xz |
[asan] fix atexit stats
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192956 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_rtl.cc | 9 | ||||
-rw-r--r-- | lib/asan/lit_tests/TestCases/assign_large_valloc_to_global.cc | 3 | ||||
-rw-r--r-- | lib/asan/lit_tests/TestCases/atexit_stats.cc | 11 |
3 files changed, 15 insertions, 8 deletions
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index ce7278f0..2b4114a0 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -474,11 +474,6 @@ void __asan_init() { // Setup internal allocator callback. SetLowLevelAllocateCallback(OnLowLevelAllocate); - if (flags()->atexit) { - Atexit(asan_atexit); - } - - // interceptors InitializeAsanInterceptors(); ReplaceSystemMalloc(); @@ -551,6 +546,10 @@ void __asan_init() { asan_inited = 1; asan_init_is_running = false; + if (flags()->atexit) + Atexit(asan_atexit); + + // interceptors InitTlsSize(); // Create main thread. diff --git a/lib/asan/lit_tests/TestCases/assign_large_valloc_to_global.cc b/lib/asan/lit_tests/TestCases/assign_large_valloc_to_global.cc index 87a65984..e5b2e661 100644 --- a/lib/asan/lit_tests/TestCases/assign_large_valloc_to_global.cc +++ b/lib/asan/lit_tests/TestCases/assign_large_valloc_to_global.cc @@ -1,9 +1,6 @@ // Make sure we don't report a leak nor hang. // RUN: %clangxx_asan -O3 %s -o %t && %t -#if defined(__APPLE__) #include <stdlib.h> -#else #include <malloc.h> -#endif int *p = (int*)valloc(1 << 20); int main() { } diff --git a/lib/asan/lit_tests/TestCases/atexit_stats.cc b/lib/asan/lit_tests/TestCases/atexit_stats.cc new file mode 100644 index 00000000..10b4fac4 --- /dev/null +++ b/lib/asan/lit_tests/TestCases/atexit_stats.cc @@ -0,0 +1,11 @@ +// Make sure we report atexit stats. +// RUN: %clangxx_asan -O3 %s -o %t +// RUN: ASAN_OPTIONS=atexit=1:print_stats=1 %t 2>&1 | FileCheck %s +#include <stdlib.h> +#include <malloc.h> +int *p1 = (int*)malloc(900); +int *p2 = (int*)malloc(90000); +int *p3 = (int*)malloc(9000000); +int main() { } + +// CHECK: AddressSanitizer exit stats: |