[compiler-rt] r216265 - [ASan/Win] Land the trivial bits of -MD RTL support (PR20214)

Timur Iskhodzhanov timurrrr at google.com
Fri Aug 22 05:38:07 PDT 2014


Author: timurrrr
Date: Fri Aug 22 07:38:07 2014
New Revision: 216265

URL: http://llvm.org/viewvc/llvm-project?rev=216265&view=rev
Log:
[ASan/Win] Land the trivial bits of -MD RTL support (PR20214)

Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.cc
    compiler-rt/trunk/lib/asan/asan_win.cc
    compiler-rt/trunk/lib/interception/interception.h
    compiler-rt/trunk/lib/interception/interception_win.cc
    compiler-rt/trunk/test/asan/lit.cfg

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=216265&r1=216264&r2=216265&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Fri Aug 22 07:38:07 2014
@@ -309,6 +309,10 @@ INTERCEPTOR(int, _except_handler3, void
   return REAL(_except_handler3)(a, b, c, d);
 }
 
+#if ASAN_DYNAMIC
+// This handler is named differently in -MT and -MD CRTs.
+#define _except_handler4 _except_handler4_common
+#endif
 INTERCEPTOR(int, _except_handler4, void *a, void *b, void *c, void *d) {
   CHECK(REAL(_except_handler4));
   __asan_handle_no_return();

Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=216265&r1=216264&r2=216265&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Fri Aug 22 07:38:07 2014
@@ -71,7 +71,7 @@ void *AsanDoesNotSupportStaticLinkage()
   return 0;
 }
 
-void AsanCheckDynamicRTPrereqs() { UNIMPLEMENTED(); }
+void AsanCheckDynamicRTPrereqs() {}
 
 void AsanCheckIncompatibleRT() {}
 

Modified: compiler-rt/trunk/lib/interception/interception.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception.h?rev=216265&r1=216264&r2=216265&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception.h (original)
+++ compiler-rt/trunk/lib/interception/interception.h Fri Aug 22 07:38:07 2014
@@ -122,15 +122,9 @@ const interpose_substitution substitutio
 # define DECLARE_WRAPPER(ret_type, func, ...)
 
 #elif defined(_WIN32)
-# if defined(_DLL)  // DLL CRT
-#  define WRAP(x) x
-#  define WRAPPER_NAME(x) #x
-#  define INTERCEPTOR_ATTRIBUTE
-# else  // Static CRT
-#  define WRAP(x) __asan_wrap_##x
-#  define WRAPPER_NAME(x) "__asan_wrap_"#x
-#  define INTERCEPTOR_ATTRIBUTE __declspec(dllexport)
-# endif
+# define WRAP(x) __asan_wrap_##x
+# define WRAPPER_NAME(x) "__asan_wrap_"#x
+# define INTERCEPTOR_ATTRIBUTE __declspec(dllexport)
 # define DECLARE_WRAPPER(ret_type, func, ...) \
     extern "C" ret_type func(__VA_ARGS__);
 # define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \

Modified: compiler-rt/trunk/lib/interception/interception_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception_win.cc?rev=216265&r1=216264&r2=216265&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception_win.cc (original)
+++ compiler-rt/trunk/lib/interception/interception_win.cc Fri Aug 22 07:38:07 2014
@@ -96,6 +96,7 @@ static size_t RoundUpToInstrBoundary(siz
       case 0x458B:  // 8B 45 XX = mov eax, dword ptr [ebp+XXh]
       case 0x5D8B:  // 8B 5D XX = mov ebx, dword ptr [ebp+XXh]
       case 0xEC83:  // 83 EC XX = sub esp, XX
+      case 0x75FF:  // FF 75 XX = push dword ptr [ebp+XXh]
         cursor += 3;
         continue;
       case 0xC1F7:  // F7 C1 XX YY ZZ WW = test ecx, WWZZYYXX

Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=216265&r1=216264&r2=216265&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Fri Aug 22 07:38:07 2014
@@ -81,6 +81,8 @@ if platform.system() == 'Windows':
                             "-WX",
                             "-D_HAS_EXCEPTIONS=0",
                             "-Zi"] + target_cflags
+  if config.asan_dynamic:
+    clang_cl_asan_cxxflags.append("-MD")
   clang_invocation = build_invocation(clang_cl_asan_cxxflags)
   clang_cl_invocation = clang_invocation.replace("clang.exe","clang-cl.exe")
   config.substitutions.append( ("%clang_cl_asan ", clang_cl_invocation) )





More information about the llvm-commits mailing list