[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
[blocksruntime.git] / lib / asan / asan_win.cc
blob54fec2b14edf3abc045532ba7792774b2dbb526d
1 //===-- asan_win.cc -------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of AddressSanitizer, an address sanity checker.
12 // Windows-specific details.
13 //===----------------------------------------------------------------------===//
15 #include "sanitizer_common/sanitizer_platform.h"
16 #if SANITIZER_WINDOWS
17 #include <windows.h>
19 #include <dbghelp.h>
20 #include <stdlib.h>
22 #include "asan_interceptors.h"
23 #include "asan_internal.h"
24 #include "asan_thread.h"
25 #include "sanitizer_common/sanitizer_libc.h"
26 #include "sanitizer_common/sanitizer_mutex.h"
28 extern "C" {
29 SANITIZER_INTERFACE_ATTRIBUTE
30 int __asan_should_detect_stack_use_after_return() {
31 __asan_init();
32 return __asan_option_detect_stack_use_after_return;
36 namespace __asan {
38 // ---------------------- TSD ---------------- {{{1
39 static bool tsd_key_inited = false;
41 static __declspec(thread) void *fake_tsd = 0;
43 void AsanTSDInit(void (*destructor)(void *tsd)) {
44 // FIXME: we're ignoring the destructor for now.
45 tsd_key_inited = true;
48 void *AsanTSDGet() {
49 CHECK(tsd_key_inited);
50 return fake_tsd;
53 void AsanTSDSet(void *tsd) {
54 CHECK(tsd_key_inited);
55 fake_tsd = tsd;
58 void PlatformTSDDtor(void *tsd) {
59 AsanThread::TSDDtor(tsd);
61 // ---------------------- Various stuff ---------------- {{{1
62 void MaybeReexec() {
63 // No need to re-exec on Windows.
66 void *AsanDoesNotSupportStaticLinkage() {
67 #if defined(_DEBUG)
68 #error Please build the runtime with a non-debug CRT: /MD or /MT
69 #endif
70 return 0;
73 void AsanPlatformThreadInit() {
74 // Nothing here for now.
77 void ReadContextStack(void *context, uptr *stack, uptr *ssize) {
78 UNIMPLEMENTED();
81 void AsanOnSIGSEGV(int, void *siginfo, void *context) {
82 UNIMPLEMENTED();
85 } // namespace __asan
87 #endif // _WIN32