[compiler-rt] r213656 - [ASan/Win] Add SEH handling to the DLL thunk as well

Timur Iskhodzhanov timurrrr at google.com
Tue Jul 22 07:02:53 PDT 2014


Author: timurrrr
Date: Tue Jul 22 09:02:53 2014
New Revision: 213656

URL: http://llvm.org/viewvc/llvm-project?rev=213656&view=rev
Log:
[ASan/Win] Add SEH handling to the DLL thunk as well

Added:
    compiler-rt/trunk/test/asan/TestCases/Windows/dll_seh.cc
      - copied, changed from r213655, compiler-rt/trunk/test/asan/TestCases/Windows/seh.cc
Modified:
    compiler-rt/trunk/lib/asan/asan_dll_thunk.cc

Modified: compiler-rt/trunk/lib/asan/asan_dll_thunk.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_dll_thunk.cc?rev=213656&r1=213655&r2=213656&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_dll_thunk.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_dll_thunk.cc Tue Jul 22 09:02:53 2014
@@ -251,6 +251,9 @@ INTERFACE_FUNCTION(__asan_unpoison_stack
 INTERFACE_FUNCTION(__asan_poison_memory_region)
 INTERFACE_FUNCTION(__asan_unpoison_memory_region)
 
+INTERFACE_FUNCTION(__asan_address_is_poisoned)
+INTERFACE_FUNCTION(__asan_region_is_poisoned)
+
 INTERFACE_FUNCTION(__asan_get_current_fake_stack)
 INTERFACE_FUNCTION(__asan_addr_is_in_fake_stack)
 
@@ -307,6 +310,7 @@ WRAP_W_W(_expand_dbg)
 
 INTERCEPT_LIBRARY_FUNCTION(atoi);
 INTERCEPT_LIBRARY_FUNCTION(atol);
+INTERCEPT_LIBRARY_FUNCTION(_except_handler3);
 INTERCEPT_LIBRARY_FUNCTION(frexp);
 INTERCEPT_LIBRARY_FUNCTION(longjmp);
 INTERCEPT_LIBRARY_FUNCTION(memchr);

Copied: compiler-rt/trunk/test/asan/TestCases/Windows/dll_seh.cc (from r213655, compiler-rt/trunk/test/asan/TestCases/Windows/seh.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/dll_seh.cc?p2=compiler-rt/trunk/test/asan/TestCases/Windows/dll_seh.cc&p1=compiler-rt/trunk/test/asan/TestCases/Windows/seh.cc&r1=213655&r2=213656&rev=213656&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/seh.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/dll_seh.cc Tue Jul 22 09:02:53 2014
@@ -3,9 +3,10 @@
 // the rest is built with Clang.  This represents the typical scenario when we
 // build a large project using "clang-cl -fallback -fsanitize=address".
 //
-// RUN: cl -Zi -FS -GS- -c %s -Fo%t.obj
-// RUN: %clangxx_asan -o %t.exe %s %t.obj
-// RUN: %run %t.exe
+// RUN: %clang_cl_asan -O0 %p/dll_host.cc -Fe%t
+// RUN: cl -LD -Zi -FS -GS- -c %s -Fo%t.obj
+// RUN: %clang_cl_asan -LD -O0 %s -Fe%t.dll %t.obj
+// RUN: %run %t %t.dll
 
 #include <windows.h>
 #include <assert.h>
@@ -36,7 +37,8 @@ void ThrowAndCatch() {
 }
 #else
 
-int main() {
+extern "C" __declspec(dllexport)
+int test_function() {
   char x[32];
   fprintf(stderr, "Before: %p poisoned: %d\n", &x,
           __asan_address_is_poisoned(x + 32));
@@ -47,5 +49,6 @@ int main() {
   // FIXME: Invert this assertion once we fix
   // https://code.google.com/p/address-sanitizer/issues/detail?id=258
   assert(!__asan_address_is_poisoned(x + 32));
+  return 0;
 }
 #endif





More information about the llvm-commits mailing list