1//===-- copyprof_preinit.cpp ---------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// This file sets up early pre-initialization hooks for CopyProf, ensuring the
10/// runtime initializes before any instrumented application code runs.
11///
12//===----------------------------------------------------------------------===//
13
14#include "copyprof_interface_internal.h"
15
16using namespace __copyprof;
17
18// Make sure CopyProf initialization runs as early as possible as some
19// applications use preinit_array on their own.
20#if SANITIZER_CAN_USE_PREINIT_ARRAY
21__attribute__((section(".preinit_array"), used)) static auto preinit =
22 __copyprof_init_once;
23#endif
24