* config/rs6000/rs6000.c (rs6000_output_symbol_ref): Move storage
[official-gcc.git] / libsanitizer / ubsan / ubsan_init_standalone.cc
blob1630fd724fb0b38f45e294cff27485295d6d6af2
1 //===-- ubsan_init_standalone.cc ------------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Initialization of standalone UBSan runtime.
9 //
10 //===----------------------------------------------------------------------===//
12 #include "ubsan_platform.h"
13 #if !CAN_SANITIZE_UB
14 # error "UBSan is not supported on this platform!"
15 #endif
17 #include "sanitizer_common/sanitizer_internal_defs.h"
18 #include "ubsan_init.h"
20 #if SANITIZER_CAN_USE_PREINIT_ARRAY
21 __attribute__((section(".preinit_array"), used))
22 void (*__local_ubsan_preinit)(void) = __ubsan::InitAsStandalone;
23 #else
24 // Use a dynamic initializer.
25 class UbsanStandaloneInitializer {
26 public:
27 UbsanStandaloneInitializer() {
28 __ubsan::InitAsStandalone();
31 static UbsanStandaloneInitializer ubsan_standalone_initializer;
32 #endif // SANITIZER_CAN_USE_PREINIT_ARRAY