]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/asan/asan_preinit.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / lib / asan / asan_preinit.cc
CommitLineData
1a4d82fc
JJ
1//===-- asan_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 AddressSanitizer, an address sanity checker.
11//
12// Call __asan_init at the very early stage of process startup.
1a4d82fc
JJ
13//===----------------------------------------------------------------------===//
14#include "asan_internal.h"
15
92a42be0
SL
16using namespace __asan;
17
18#if SANITIZER_CAN_USE_PREINIT_ARRAY
1a4d82fc
JJ
19 // The symbol is called __local_asan_preinit, because it's not intended to be
20 // exported.
92a42be0
SL
21 // This code linked into the main executable when -fsanitize=address is in
22 // the link flags. It can only use exported interface functions.
1a4d82fc
JJ
23 __attribute__((section(".preinit_array"), used))
24 void (*__local_asan_preinit)(void) = __asan_init;
1a4d82fc 25#endif