1//===-- ubsan_offload_preinit.cpp -------------------------------*- C++ -*-===//
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// Call __ubsan_offload_init at the very early stage of process startup.
10//
11//===----------------------------------------------------------------------===//
12
13#include "sanitizer_common/sanitizer_internal_defs.h"
14#include "ubsan_offload.h"
15
16#if SANITIZER_CAN_USE_PREINIT_ARRAY
17// This section is linked into the main executable when offloading uses UBSan
18// to perform initialization at a very early stage.
19__attribute__((section(".preinit_array"), used)) static auto preinit =
20 __ubsan_offload_init;
21#endif
22