xref: /llvm-project/compiler-rt/lib/rtsan/rtsan_preinit.cpp (revision 3477eb722fe094a6143108813ff017145aa9ef8a)
11adb55b1SChris Apple //===--- rtsan_preinit.cpp - Realtime Sanitizer -----------------*- C++ -*-===//
21adb55b1SChris Apple //
31adb55b1SChris Apple // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
41adb55b1SChris Apple // See https://llvm.org/LICENSE.txt for license information.
51adb55b1SChris Apple // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
61adb55b1SChris Apple //
71adb55b1SChris Apple //===----------------------------------------------------------------------===//
81adb55b1SChris Apple //
91adb55b1SChris Apple //===----------------------------------------------------------------------===//
101adb55b1SChris Apple 
11*3477eb72SChris Apple #include "rtsan/rtsan.h"
121adb55b1SChris Apple #include "sanitizer_common/sanitizer_internal_defs.h"
131adb55b1SChris Apple 
141adb55b1SChris Apple #if SANITIZER_CAN_USE_PREINIT_ARRAY
151adb55b1SChris Apple 
16bb8230bbSFangrui Song // This section is linked into the main executable when -fsanitize=realtime is
17bb8230bbSFangrui Song // specified to perform initialization at a very early stage.
18bb8230bbSFangrui Song __attribute__((section(".preinit_array"), used)) static auto preinit =
19bb8230bbSFangrui Song     __rtsan_init;
201adb55b1SChris Apple 
211adb55b1SChris Apple #endif
22