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