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