1 //===-- tsan_preinit.cc ---------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of ThreadSanitizer.
12 // Call __tsan_init at the very early stage of process startup.
13 //===----------------------------------------------------------------------===//
15 #include "sanitizer_common/sanitizer_internal_defs.h"
16 #include "tsan_interface.h"
18 #if SANITIZER_CAN_USE_PREINIT_ARRAY
20 // The symbol is called __local_tsan_preinit, because it's not intended to be
22 // This code linked into the main executable when -fsanitize=thread is in
23 // the link flags. It can only use exported interface functions.
24 __attribute__((section(".preinit_array"), used))
25 void (*__local_tsan_preinit)(void) = __tsan_init;