xref: /llvm-project/compiler-rt/lib/asan/asan_win_common_runtime_thunk.h (revision 0265981b6ec0f46fc372897fef7f945d8f4625c2)
1 //===-- asan_win_common_runtime_thunk.h -------------------------*- C++ -*-===//
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 // This file is a part of AddressSanitizer, an address sanity checker.
10 //
11 // This file defines things that need to be present in the application modules
12 // to interact with the ASan DLL runtime correctly and can't be implemented
13 // using the default "import library" generated when linking the DLL.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #if defined(SANITIZER_STATIC_RUNTIME_THUNK) || \
18     defined(SANITIZER_DYNAMIC_RUNTIME_THUNK)
19 #  include "sanitizer_common/sanitizer_win_defs.h"
20 
21 #  pragma section(".CRT$XIB", long, \
22                   read)  // C initializer (during C init before dyninit)
23 #  pragma section(".CRT$XID", long, \
24                   read)  // First C initializer after CRT initializers
25 #  pragma section(".CRT$XCAB", long, \
26                   read)  // First C++ initializer after startup initializers
27 
28 #  pragma section(".CRT$XTW", long, read)  // First ASAN globals terminator
29 #  pragma section(".CRT$XTY", long, read)  // Last ASAN globals terminator
30 
31 #  pragma section(".CRT$XLAB", long, read)  // First TLS initializer
32 
33 #  ifdef SANITIZER_STATIC_RUNTIME_THUNK
34 extern "C" void __asan_initialize_static_thunk();
35 #  endif
36 
37 #endif  // defined(SANITIZER_STATIC_RUNTIME_THUNK) ||
38         // defined(SANITIZER_DYNAMIC_RUNTIME_THUNK)