1 //===-- asan_win.cc -------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of AddressSanitizer, an address sanity checker.
12 // Windows-specific details.
13 //===----------------------------------------------------------------------===//
15 #include "sanitizer_common/sanitizer_platform.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"
29 SANITIZER_INTERFACE_ATTRIBUTE
30 int __asan_should_detect_stack_use_after_return() {
32 return __asan_option_detect_stack_use_after_return
;
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;
49 CHECK(tsd_key_inited
);
53 void AsanTSDSet(void *tsd
) {
54 CHECK(tsd_key_inited
);
58 void PlatformTSDDtor(void *tsd
) {
59 AsanThread::TSDDtor(tsd
);
61 // ---------------------- Various stuff ---------------- {{{1
63 // No need to re-exec on Windows.
66 void *AsanDoesNotSupportStaticLinkage() {
68 #error Please build the runtime with a non-debug CRT: /MD or /MT
73 void AsanPlatformThreadInit() {
74 // Nothing here for now.
77 void ReadContextStack(void *context
, uptr
*stack
, uptr
*ssize
) {
81 void AsanOnSIGSEGV(int, void *siginfo
, void *context
) {