1 //===-- tsan_preinit.cc ---------------------------------------------------===// 2 // 3 // This file is distributed under the University of Illinois Open Source 4 // License. See LICENSE.TXT for details. 5 // 6 //===----------------------------------------------------------------------===// 7 // 8 // This file is a part of ThreadSanitizer. 9 // 10 // Call __tsan_init at the very early stage of process startup. 11 //===----------------------------------------------------------------------===// 12 13 #include "sanitizer_common/sanitizer_internal_defs.h" 14 #include "tsan_interface.h" 15 16 #if SANITIZER_CAN_USE_PREINIT_ARRAY 17 18 // The symbol is called __local_tsan_preinit, because it's not intended to be 19 // exported. 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; 24 25 #endif 26