summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-05-22 14:49:56 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-05-22 14:49:56 +0000
commitb2eb3131f4c260b0d9a7fdb36061273e5b210dad (patch)
tree9150869af610d438ce7c8d0703a06d16cf909ff1
parentb2a6fdb11a81d8b2b7ef1c34c7e50d86b282a3ff (diff)
downloadbcm5719-llvm-b2eb3131f4c260b0d9a7fdb36061273e5b210dad.tar.gz
bcm5719-llvm-b2eb3131f4c260b0d9a7fdb36061273e5b210dad.zip
[ASan/Win] Make sure the list of wrappers exported by the main module and imported by the DLL thunk always matches
llvm-svn: 209444
-rw-r--r--compiler-rt/lib/asan/asan_dll_thunk.cc2
-rw-r--r--compiler-rt/lib/asan/asan_interceptors.cc2
-rw-r--r--compiler-rt/test/asan/TestCases/Windows/dll_host.cc11
3 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_dll_thunk.cc b/compiler-rt/lib/asan/asan_dll_thunk.cc
index 48e45d2d72f..40d0e5de326 100644
--- a/compiler-rt/lib/asan/asan_dll_thunk.cc
+++ b/compiler-rt/lib/asan/asan_dll_thunk.cc
@@ -301,6 +301,8 @@ WRAP_W_W(_expand_dbg)
INTERCEPT_LIBRARY_FUNCTION(atoi);
INTERCEPT_LIBRARY_FUNCTION(atol);
+INTERCEPT_LIBRARY_FUNCTION(frexp);
+INTERCEPT_LIBRARY_FUNCTION(longjmp);
INTERCEPT_LIBRARY_FUNCTION(memchr);
INTERCEPT_LIBRARY_FUNCTION(memcmp);
INTERCEPT_LIBRARY_FUNCTION(memcpy);
diff --git a/compiler-rt/lib/asan/asan_interceptors.cc b/compiler-rt/lib/asan/asan_interceptors.cc
index cdcee9bc132..86b2042b688 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cc
+++ b/compiler-rt/lib/asan/asan_interceptors.cc
@@ -293,6 +293,7 @@ INTERCEPTOR(void, __cxa_throw, void *a, void *b, void *c) {
}
#endif
+#if ASAN_INTERCEPT_MLOCKX
// intercept mlock and friends.
// Since asan maps 16T of RAM, mlock is completely unfriendly to asan.
// All functions return 0 (success).
@@ -324,6 +325,7 @@ INTERCEPTOR(int, munlockall, void) {
MlockIsUnsupported();
return 0;
}
+#endif
static inline int CharCmp(unsigned char c1, unsigned char c2) {
return (c1 == c2) ? 0 : (c1 < c2) ? -1 : 1;
diff --git a/compiler-rt/test/asan/TestCases/Windows/dll_host.cc b/compiler-rt/test/asan/TestCases/Windows/dll_host.cc
index 44eb611daf0..8ba4cd3cd4a 100644
--- a/compiler-rt/test/asan/TestCases/Windows/dll_host.cc
+++ b/compiler-rt/test/asan/TestCases/Windows/dll_host.cc
@@ -3,6 +3,17 @@
// Just make sure we can compile this.
// The actual compile&run sequence is to be done by the DLL tests.
// RUN: %clangxx_asan -O0 %s -Fe%t
+//
+// Get the list of ASan wrappers exported by the main module RTL:
+// RUN: dumpbin /EXPORTS %t | grep -o "__asan_wrap[^ ]*" < %t.exports | grep -v @ | sort | uniq > %t.exported_wrappers
+//
+// Get the list of ASan wrappers imported by the DLL RTL:
+// RUN: grep INTERCEPT_LIBRARY_FUNCTION %p/../../../../lib/asan/asan_dll_thunk.cc | grep -v define | sed "s/.*(\(.*\)).*/__asan_wrap_\1/" | sort | uniq > %t.dll_imports
+//
+// Now make sure the DLL thunk imports everything:
+// RUN: echo
+// RUN: echo "=== NOTE === If you see a mismatch below, please update asan_dll_thunk.cc"
+// RUN: diff %t.dll_imports %t.exported_wrappers
#include <stdio.h>
#include <windows.h>
OpenPOWER on IntegriCloud