1*68d75effSDimitry Andric //===-- lsan_preinit.cpp --------------------------------------------------===// 2*68d75effSDimitry Andric // 3*68d75effSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*68d75effSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*68d75effSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*68d75effSDimitry Andric // 7*68d75effSDimitry Andric //===----------------------------------------------------------------------===// 8*68d75effSDimitry Andric // 9*68d75effSDimitry Andric // This file is a part of LeakSanitizer. 10*68d75effSDimitry Andric // 11*68d75effSDimitry Andric // Call __lsan_init at the very early stage of process startup. 12*68d75effSDimitry Andric //===----------------------------------------------------------------------===// 13*68d75effSDimitry Andric 14*68d75effSDimitry Andric #include "lsan.h" 15*68d75effSDimitry Andric 16*68d75effSDimitry Andric #if SANITIZER_CAN_USE_PREINIT_ARRAY 17*68d75effSDimitry Andric // We force __lsan_init to be called before anyone else by placing it into 18*68d75effSDimitry Andric // .preinit_array section. 19*68d75effSDimitry Andric __attribute__((section(".preinit_array"), used)) 20*68d75effSDimitry Andric void (*__local_lsan_preinit)(void) = __lsan_init; 21*68d75effSDimitry Andric #endif 22