summaryrefslogtreecommitdiff
path: root/lib/asan/asan_win.cc
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-07-15 17:28:10 +0000
committerEtienne Bergeron <etienneb@google.com>2016-07-15 17:28:10 +0000
commitaff36bd0df3a81e114f3e2d3a6c0b6d6225ebc1f (patch)
treeb1234786cdd2bc2418280645113964d951fe2e04 /lib/asan/asan_win.cc
parent3b792239023d2c56f94485d1d8a8a550276e05ea (diff)
[compiler-rt] Fix 64-bits exception handlers in ASAN 64-bits runtime
Summary: This is adding the appropriate suport for exception handling for 64-bits ASAN on windows. Reviewers: rnk Subscribers: kubabrecka, llvm-commits, wang0109, chrisha Differential Revision: https://reviews.llvm.org/D22395 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_win.cc')
-rw-r--r--lib/asan/asan_win.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/asan/asan_win.cc b/lib/asan/asan_win.cc
index 94d044a26..2ef78cd15 100644
--- a/lib/asan/asan_win.cc
+++ b/lib/asan/asan_win.cc
@@ -71,9 +71,17 @@ INTERCEPTOR_WINAPI(void, RaiseException, void *a, void *b, void *c, void *d) {
REAL(RaiseException)(a, b, c, d);
}
-// TODO(wwchrome): Win64 has no _except_handler3/4.
-// Need to implement _C_specific_handler instead.
-#ifndef _WIN64
+
+#ifdef _WIN64
+
+INTERCEPTOR_WINAPI(int, __C_specific_handler, void *a, void *b, void *c, void *d) { // NOLINT
+ CHECK(REAL(__C_specific_handler));
+ __asan_handle_no_return();
+ return REAL(__C_specific_handler)(a, b, c, d);
+}
+
+#else
+
INTERCEPTOR(int, _except_handler3, void *a, void *b, void *c, void *d) {
CHECK(REAL(_except_handler3));
__asan_handle_no_return();
@@ -154,8 +162,9 @@ void InitializePlatformInterceptors() {
ASAN_INTERCEPT_FUNC(CreateThread);
ASAN_INTERCEPT_FUNC(RaiseException);
-// TODO(wwchrome): Win64 uses _C_specific_handler instead.
-#ifndef _WIN64
+#ifdef _WIN64
+ ASAN_INTERCEPT_FUNC(__C_specific_handler);
+#else
ASAN_INTERCEPT_FUNC(_except_handler3);
ASAN_INTERCEPT_FUNC(_except_handler4);
#endif