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 
17 #if SANITIZER_CAN_USE_PREINIT_ARRAY
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
23