1 //===-- asan_win.cc -------------------------------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of AddressSanitizer, an address sanity checker.
10 // Windows-specific details.
11 //===----------------------------------------------------------------------===//
13 #include "sanitizer_common/sanitizer_platform.h"
20 #include "asan_interceptors.h"
21 #include "asan_internal.h"
22 #include "asan_thread.h"
23 #include "sanitizer_common/sanitizer_libc.h"
24 #include "sanitizer_common/sanitizer_mutex.h"
27 SANITIZER_INTERFACE_ATTRIBUTE
28 int __asan_should_detect_stack_use_after_return() {
30 return __asan_option_detect_stack_use_after_return
;
36 // ---------------------- TSD ---------------- {{{1
37 static bool tsd_key_inited
= false;
39 static __declspec(thread
) void *fake_tsd
= 0;
41 void AsanTSDInit(void (*destructor
)(void *tsd
)) {
42 // FIXME: we're ignoring the destructor for now.
43 tsd_key_inited
= true;
47 CHECK(tsd_key_inited
);
51 void AsanTSDSet(void *tsd
) {
52 CHECK(tsd_key_inited
);
56 void PlatformTSDDtor(void *tsd
) {
57 AsanThread::TSDDtor(tsd
);
59 // ---------------------- Various stuff ---------------- {{{1
61 // No need to re-exec on Windows.
64 void *AsanDoesNotSupportStaticLinkage() {
66 #error Please build the runtime with a non-debug CRT: /MD or /MT
71 void AsanCheckDynamicRTPrereqs() { UNIMPLEMENTED(); }
73 void AsanCheckIncompatibleRT() {}
75 void AsanPlatformThreadInit() {
76 // Nothing here for now.
79 void ReadContextStack(void *context
, uptr
*stack
, uptr
*ssize
) {
83 void AsanOnSIGSEGV(int, void *siginfo
, void *context
) {