1*46ba9697SNico Weber //===-- ubsan_init_standalone_preinit.cpp --------------------------------===// 2*46ba9697SNico Weber // 3*46ba9697SNico Weber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*46ba9697SNico Weber // See https://llvm.org/LICENSE.txt for license information. 5*46ba9697SNico Weber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*46ba9697SNico Weber // 7*46ba9697SNico Weber //===----------------------------------------------------------------------===// 8*46ba9697SNico Weber // 9*46ba9697SNico Weber // Initialization of standalone UBSan runtime. 10*46ba9697SNico Weber // 11*46ba9697SNico Weber //===----------------------------------------------------------------------===// 12*46ba9697SNico Weber 13*46ba9697SNico Weber #include "ubsan_platform.h" 14*46ba9697SNico Weber #if !CAN_SANITIZE_UB 15*46ba9697SNico Weber #error "UBSan is not supported on this platform!" 16*46ba9697SNico Weber #endif 17*46ba9697SNico Weber 18*46ba9697SNico Weber #include "sanitizer_common/sanitizer_internal_defs.h" 19*46ba9697SNico Weber #include "ubsan_init.h" 20*46ba9697SNico Weber #include "ubsan_signals_standalone.h" 21*46ba9697SNico Weber 22*46ba9697SNico Weber #if SANITIZER_CAN_USE_PREINIT_ARRAY 23*46ba9697SNico Weber 24*46ba9697SNico Weber namespace __ubsan { 25*46ba9697SNico Weber PreInitAsStandalone()26*46ba9697SNico Weberstatic void PreInitAsStandalone() { 27*46ba9697SNico Weber InitAsStandalone(); 28*46ba9697SNico Weber InitializeDeadlySignals(); 29*46ba9697SNico Weber } 30*46ba9697SNico Weber 31*46ba9697SNico Weber } // namespace __ubsan 32*46ba9697SNico Weber 33*46ba9697SNico Weber __attribute__((section(".preinit_array"), used)) void (*__local_ubsan_preinit)( 34*46ba9697SNico Weber void) = __ubsan::PreInitAsStandalone; 35*46ba9697SNico Weber #endif // SANITIZER_CAN_USE_PREINIT_ARRAY 36