• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef LSAN_USE_PREINIT_ARRAY
18 #define LSAN_USE_PREINIT_ARRAY 1
19 #endif
20 
21 #if LSAN_USE_PREINIT_ARRAY && !defined(PIC)
22   // We force __lsan_init to be called before anyone else by placing it into
23   // .preinit_array section.
24   __attribute__((section(".preinit_array"), used))
25   void (*__local_lsan_preinit)(void) = __lsan_init;
26 #endif
27