Index: test/asan/TestCases/Windows/dll_host.cc =================================================================== --- test/asan/TestCases/Windows/dll_host.cc +++ test/asan/TestCases/Windows/dll_host.cc @@ -5,20 +5,39 @@ // RUN: %clang_cl_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[^ ]*" | grep -v @ | sort | uniq > %t.exported_wrappers +// note: The mangling decoration (i.e. @4 )is removed because calling convention +// differ from 32-bit and 64-bit. +// RUN: dumpbin /EXPORTS %t | grep -o "__asan_wrap[^ ]*" | sed -e s/@.*// > %t.exported_wrappers // FIXME: we should really check the other __asan exports too. -// RUN: dumpbin /EXPORTS %t | grep -o "__sanitizer_[^ ]*" | grep -v @ | sort | uniq >> %t.exported_wrappers +// RUN: dumpbin /EXPORTS %t | grep -o "__sanitizer_[^ ]*" | sed -e s/@.*// >> %t.exported_wrappers // // Get the list of ASan wrappers imported by the DLL RTL: // [BEWARE: be really careful with the sed commands, as this test can be run // from different environemnts with different shells and seds] -// RUN: grep INTERCEPT_LIBRARY_FUNCTION %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(/__asan_wrap_/ | sed -e s/).*// | sort | uniq > %t.dll_imports -// RUN: grep "^INTERFACE_FUNCTION.*sanitizer" %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(// | sed -e s/).*// | sort | uniq >> %t.dll_imports +// RUN: grep INTERCEPT_LIBRARY_FUNCTION %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(/__asan_wrap_/ | sed -e s/).*// > %t.dll_imports +// RUN: grep "^INTERFACE_FUNCTION.*sanitizer" %p/../../../../lib/asan/asan_win_dll_thunk.cc | grep -v define | sed -e s/.*(// | sed -e s/).*// >> %t.dll_imports +// +// Add functions interecepted in asan_malloc.win.cc and asan_win.cc. +// RUN: echo "__asan_wrap_HeapAlloc" >> %t.dll_imports +// RUN: echo "__asan_wrap_HeapFree" >> %t.dll_imports +// RUN: echo "__asan_wrap_HeapReAlloc" >> %t.dll_imports +// RUN: echo "__asan_wrap_HeapSize" >> %t.dll_imports +// RUN: echo "__asan_wrap_CreateThread" >> %t.dll_imports +// RUN: echo "__asan_wrap_NtWaitForWorkViaWorkerFactory" >> %t.dll_imports +// RUN: echo "__asan_wrap_RaiseException" >> %t.dll_imports +// +// The exception handlers differ in 32-bit and 64-bit, so we ignore them: +// RUN: echo "__asan_wrap__except_handler3" >> %t.exported_wrappers +// RUN: echo "__asan_wrap__except_handler4" >> %t.exported_wrappers +// RUN: echo "__asan_wrap___C_specific_handler" >> %t.exported_wrappers +// +// RUN: sort %t.dll_imports | uniq > %t.dll_imports-sorted +// RUN: sort %t.exported_wrappers | uniq > %t.exported_wrappers-sorted // // Now make sure the DLL thunk imports everything: // RUN: echo // RUN: echo "=== NOTE === If you see a mismatch below, please update asan_win_dll_thunk.cc" -// RUN: diff %t.dll_imports %t.exported_wrappers +// RUN: diff %t.dll_imports-sorted %t.exported_wrappers-sorted // REQUIRES: asan-static-runtime #include