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