comparison libsanitizer/ubsan/ubsan_init_standalone_preinit.cpp @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 //===-- ubsan_init_standalone_preinit.cpp --------------------------------===//
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 // Initialization of standalone UBSan runtime.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "ubsan_platform.h"
14 #if !CAN_SANITIZE_UB
15 #error "UBSan is not supported on this platform!"
16 #endif
17
18 #include "sanitizer_common/sanitizer_internal_defs.h"
19 #include "ubsan_init.h"
20 #include "ubsan_signals_standalone.h"
21
22 #if SANITIZER_CAN_USE_PREINIT_ARRAY
23
24 namespace __ubsan {
25
26 static void PreInitAsStandalone() {
27 InitAsStandalone();
28 InitializeDeadlySignals();
29 }
30
31 } // namespace __ubsan
32
33 __attribute__((section(".preinit_array"), used)) void (*__local_ubsan_preinit)(
34 void) = __ubsan::PreInitAsStandalone;
35 #endif // SANITIZER_CAN_USE_PREINIT_ARRAY