xref: /freebsd/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_preinit.cpp (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
168d75effSDimitry Andric //===-- tsan_preinit.cpp --------------------------------------------------===//
268d75effSDimitry Andric //
368d75effSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
468d75effSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
568d75effSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
668d75effSDimitry Andric //
768d75effSDimitry Andric //===----------------------------------------------------------------------===//
868d75effSDimitry Andric //
968d75effSDimitry Andric // This file is a part of ThreadSanitizer.
1068d75effSDimitry Andric //
1168d75effSDimitry Andric // Call __tsan_init at the very early stage of process startup.
1268d75effSDimitry Andric //===----------------------------------------------------------------------===//
1368d75effSDimitry Andric 
1468d75effSDimitry Andric #include "sanitizer_common/sanitizer_internal_defs.h"
1568d75effSDimitry Andric #include "tsan_interface.h"
1668d75effSDimitry Andric 
1768d75effSDimitry Andric #if SANITIZER_CAN_USE_PREINIT_ARRAY
1868d75effSDimitry Andric 
19*0fca6ea1SDimitry Andric // This section is linked into the main executable when -fsanitize=thread is
20*0fca6ea1SDimitry Andric // specified to perform initialization at a very early stage.
21*0fca6ea1SDimitry Andric __attribute__((section(".preinit_array"), used)) static auto preinit =
22*0fca6ea1SDimitry Andric     __tsan_init;
2368d75effSDimitry Andric 
2468d75effSDimitry Andric #endif
25