1*217222abSNico Weber //===-- asan_preinit.cpp --------------------------------------------------===// 2*217222abSNico Weber // 3*217222abSNico Weber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*217222abSNico Weber // See https://llvm.org/LICENSE.txt for license information. 5*217222abSNico Weber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*217222abSNico Weber // 7*217222abSNico Weber //===----------------------------------------------------------------------===// 8*217222abSNico Weber // 9*217222abSNico Weber // This file is a part of AddressSanitizer, an address sanity checker. 10*217222abSNico Weber // 11*217222abSNico Weber // Call __asan_init at the very early stage of process startup. 12*217222abSNico Weber //===----------------------------------------------------------------------===// 13*217222abSNico Weber #include "asan_internal.h" 14*217222abSNico Weber 15*217222abSNico Weber using namespace __asan; 16*217222abSNico Weber 17*217222abSNico Weber #if SANITIZER_CAN_USE_PREINIT_ARRAY 18*217222abSNico Weber // The symbol is called __local_asan_preinit, because it's not intended to be 19*217222abSNico Weber // exported. 20*217222abSNico Weber // This code linked into the main executable when -fsanitize=address is in 21*217222abSNico Weber // the link flags. It can only use exported interface functions. 22*217222abSNico Weber __attribute__((section(".preinit_array"), used)) 23*217222abSNico Weber void (*__local_asan_preinit)(void) = __asan_init; 24*217222abSNico Weber #endif 25