[ASan/Win] Make sure the list of wrappers exported by the main module and imported by the DLL thunk always matches

llvm-svn: 209444
This commit is contained in:
Timur Iskhodzhanov 2014-05-22 14:49:56 +00:00
parent b2a6fdb11a
commit b2eb3131f4
3 changed files with 15 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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>