xref: /freebsd-src/contrib/llvm-project/compiler-rt/lib/hwasan/hwasan_preinit.cpp (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
181ad6265SDimitry Andric //===-- hwasan_preinit.cpp ------------------------------------------------===//
281ad6265SDimitry Andric //
381ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
481ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
581ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
681ad6265SDimitry Andric //
781ad6265SDimitry Andric //===----------------------------------------------------------------------===//
881ad6265SDimitry Andric //
981ad6265SDimitry Andric // This file is a part of HWAddressSanitizer, an address sanity checker.
1081ad6265SDimitry Andric //
1181ad6265SDimitry Andric // Call __hwasan_init at the very early stage of process startup.
1281ad6265SDimitry Andric //===----------------------------------------------------------------------===//
1381ad6265SDimitry Andric #include "hwasan_interface_internal.h"
1481ad6265SDimitry Andric #include "sanitizer_common/sanitizer_internal_defs.h"
1581ad6265SDimitry Andric 
1681ad6265SDimitry Andric #if SANITIZER_CAN_USE_PREINIT_ARRAY
17*0fca6ea1SDimitry Andric // This section is linked into the main executable when -fsanitize=hwaddress is
18*0fca6ea1SDimitry Andric // specified to perform initialization at a very early stage.
19*0fca6ea1SDimitry Andric __attribute__((section(".preinit_array"), used)) static auto preinit =
20*0fca6ea1SDimitry Andric     __hwasan_init;
2181ad6265SDimitry Andric #endif
22