xref: /netbsd-src/sys/external/bsd/compiler_rt/dist/lib/lsan/lsan_preinit.cc (revision a7c257b03e4462df2b1020128fb82716512d7856)
1*a7c257b0Skamil //===-- lsan_preinit.cc ---------------------------------------------------===//
2*a7c257b0Skamil //
3*a7c257b0Skamil //                     The LLVM Compiler Infrastructure
4*a7c257b0Skamil //
5*a7c257b0Skamil // This file is distributed under the University of Illinois Open Source
6*a7c257b0Skamil // License. See LICENSE.TXT for details.
7*a7c257b0Skamil //
8*a7c257b0Skamil //===----------------------------------------------------------------------===//
9*a7c257b0Skamil //
10*a7c257b0Skamil // This file is a part of LeakSanitizer.
11*a7c257b0Skamil //
12*a7c257b0Skamil // Call __lsan_init at the very early stage of process startup.
13*a7c257b0Skamil //===----------------------------------------------------------------------===//
14*a7c257b0Skamil 
15*a7c257b0Skamil #include "lsan.h"
16*a7c257b0Skamil 
17*a7c257b0Skamil #if SANITIZER_CAN_USE_PREINIT_ARRAY
18*a7c257b0Skamil   // We force __lsan_init to be called before anyone else by placing it into
19*a7c257b0Skamil   // .preinit_array section.
20*a7c257b0Skamil   __attribute__((section(".preinit_array"), used))
21*a7c257b0Skamil   void (*__local_lsan_preinit)(void) = __lsan_init;
22*a7c257b0Skamil #endif
23