2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
[official-gcc.git] / libsanitizer / tsan / tsan_preinit.cc
blobd5d1659c09b69e2628db18c29cd385695c291d09
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 //===----------------------------------------------------------------------===//
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
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;
25 #endif