xref: /openbsd-src/gnu/llvm/compiler-rt/lib/lsan/lsan_preinit.cpp (revision 3cab2bb3f667058bece8e38b12449a63a9d73c4b)
1*3cab2bb3Spatrick //===-- lsan_preinit.cpp --------------------------------------------------===//
2*3cab2bb3Spatrick //
3*3cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*3cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
5*3cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*3cab2bb3Spatrick //
7*3cab2bb3Spatrick //===----------------------------------------------------------------------===//
8*3cab2bb3Spatrick //
9*3cab2bb3Spatrick // This file is a part of LeakSanitizer.
10*3cab2bb3Spatrick //
11*3cab2bb3Spatrick // Call __lsan_init at the very early stage of process startup.
12*3cab2bb3Spatrick //===----------------------------------------------------------------------===//
13*3cab2bb3Spatrick 
14*3cab2bb3Spatrick #include "lsan.h"
15*3cab2bb3Spatrick 
16*3cab2bb3Spatrick #if SANITIZER_CAN_USE_PREINIT_ARRAY
17*3cab2bb3Spatrick   // We force __lsan_init to be called before anyone else by placing it into
18*3cab2bb3Spatrick   // .preinit_array section.
19*3cab2bb3Spatrick   __attribute__((section(".preinit_array"), used))
20*3cab2bb3Spatrick   void (*__local_lsan_preinit)(void) = __lsan_init;
21*3cab2bb3Spatrick #endif
22