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