13d4bba30STeresa Johnson //===-- memprof_preinit.cpp ----------------------------------------------===// 23d4bba30STeresa Johnson // 33d4bba30STeresa Johnson // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 43d4bba30STeresa Johnson // See https://llvm.org/LICENSE.txt for license information. 53d4bba30STeresa Johnson // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 63d4bba30STeresa Johnson // 73d4bba30STeresa Johnson //===----------------------------------------------------------------------===// 83d4bba30STeresa Johnson // 93d4bba30STeresa Johnson // This file is a part of MemProfiler, a memory profiler. 103d4bba30STeresa Johnson // 113d4bba30STeresa Johnson // Call __memprof_init at the very early stage of process startup. 123d4bba30STeresa Johnson //===----------------------------------------------------------------------===// 133d4bba30STeresa Johnson #include "memprof_internal.h" 143d4bba30STeresa Johnson 153d4bba30STeresa Johnson using namespace __memprof; 163d4bba30STeresa Johnson 173d4bba30STeresa Johnson #if SANITIZER_CAN_USE_PREINIT_ARRAY 18*bb8230bbSFangrui Song // This section is linked into the main executable when -fmemory-profile is 19*bb8230bbSFangrui Song // specified to perform initialization at a very early stage. 20*bb8230bbSFangrui Song __attribute__((section(".preinit_array"), used)) static auto preinit = 21*bb8230bbSFangrui Song __memprof_preinit; 223d4bba30STeresa Johnson #endif 23