Sergey Matveev | 6b0f6af | 2013-11-25 14:30:37 +0000 | [diff] [blame] | 1 | //===-- lsan_preinit.cc ---------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is a part of LeakSanitizer. |
| 11 | // |
| 12 | // Call __lsan_init at the very early stage of process startup. |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "lsan.h" |
| 16 | |
Alexey Samsonov | 2178054 | 2014-07-25 22:05:02 +0000 | [diff] [blame] | 17 | #if SANITIZER_CAN_USE_PREINIT_ARRAY |
Sergey Matveev | 6b0f6af | 2013-11-25 14:30:37 +0000 | [diff] [blame] | 18 | // We force __lsan_init to be called before anyone else by placing it into |
| 19 | // .preinit_array section. |
| 20 | __attribute__((section(".preinit_array"), used)) |
| 21 | void (*__local_lsan_preinit)(void) = __lsan_init; |
| 22 | #endif |