xref: /freebsd/contrib/llvm-project/compiler-rt/lib/nsan/nsan_preinit.cpp (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===- nsan_preinit.cpp ---------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Call __nsan_init early using ELF DT_PREINIT_ARRAY.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "nsan/nsan.h"
14 #include "sanitizer_common/sanitizer_internal_defs.h"
15 
16 #if SANITIZER_CAN_USE_PREINIT_ARRAY
17 
18 __attribute__((section(".preinit_array"), used)) static auto nsan_preinit =
19     __nsan_init;
20 
21 #endif
22