xref: /llvm-project/compiler-rt/lib/hwasan/hwasan_preinit.cpp (revision bb8230bb2bcc9b68fbe9b9c02ac1c85dee4c80a0)
195d609b5SMatt Morehouse //===-- hwasan_preinit.cpp ------------------------------------------------===//
295d609b5SMatt Morehouse //
395d609b5SMatt Morehouse // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
495d609b5SMatt Morehouse // See https://llvm.org/LICENSE.txt for license information.
595d609b5SMatt Morehouse // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
695d609b5SMatt Morehouse //
795d609b5SMatt Morehouse //===----------------------------------------------------------------------===//
895d609b5SMatt Morehouse //
995d609b5SMatt Morehouse // This file is a part of HWAddressSanitizer, an address sanity checker.
1095d609b5SMatt Morehouse //
1195d609b5SMatt Morehouse // Call __hwasan_init at the very early stage of process startup.
1295d609b5SMatt Morehouse //===----------------------------------------------------------------------===//
1395d609b5SMatt Morehouse #include "hwasan_interface_internal.h"
1495d609b5SMatt Morehouse #include "sanitizer_common/sanitizer_internal_defs.h"
1595d609b5SMatt Morehouse 
1695d609b5SMatt Morehouse #if SANITIZER_CAN_USE_PREINIT_ARRAY
17*bb8230bbSFangrui Song // This section is linked into the main executable when -fsanitize=hwaddress is
18*bb8230bbSFangrui Song // specified to perform initialization at a very early stage.
19*bb8230bbSFangrui Song __attribute__((section(".preinit_array"), used)) static auto preinit =
20*bb8230bbSFangrui Song     __hwasan_init;
2195d609b5SMatt Morehouse #endif
22