1353944Sdim//===-- asan_preinit.cpp --------------------------------------------------===// 2353944Sdim// 3353944Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353944Sdim// See https://llvm.org/LICENSE.txt for license information. 5353944Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6353944Sdim// 7353944Sdim//===----------------------------------------------------------------------===// 8353944Sdim// 9353944Sdim// This file is a part of AddressSanitizer, an address sanity checker. 10353944Sdim// 11353944Sdim// Call __asan_init at the very early stage of process startup. 12353944Sdim//===----------------------------------------------------------------------===// 13353944Sdim#include "asan_internal.h" 14353944Sdim 15353944Sdimusing namespace __asan; 16353944Sdim 17353944Sdim#if SANITIZER_CAN_USE_PREINIT_ARRAY 18353944Sdim // The symbol is called __local_asan_preinit, because it's not intended to be 19353944Sdim // exported. 20353944Sdim // This code linked into the main executable when -fsanitize=address is in 21353944Sdim // the link flags. It can only use exported interface functions. 22353944Sdim __attribute__((section(".preinit_array"), used)) 23353944Sdim void (*__local_asan_preinit)(void) = __asan_init; 24353944Sdim#endif 25