]> granicus.if.org Git - clang/commitdiff
[ASan/Win] Fix PR20918 -- SEH handler doesn't work with the MD runtime
authorTimur Iskhodzhanov <timurrrr@google.com>
Fri, 12 Sep 2014 14:01:30 +0000 (14:01 +0000)
committerTimur Iskhodzhanov <timurrrr@google.com>
Fri, 12 Sep 2014 14:01:30 +0000 (14:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217679 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/cl-link.c

index 7fb1a1a33c79364fae9bdb81dcd907a6a340467a..0e1dea2a97f6a06346e13e2efa3d54c738750bc8 100644 (file)
@@ -7822,6 +7822,9 @@ void visualstudio::Link::ConstructJob(Compilation &C, const JobAction &JA,
       addSanitizerRTWindows(getToolChain(), Args, CmdArgs, "asan_dynamic-i386");
       addSanitizerRTWindows(getToolChain(), Args, CmdArgs,
                             "asan_dynamic_runtime_thunk-i386");
+      // Make sure the dynamic runtime thunk is not optimized out at link time
+      // to ensure proper SEH handling.
+      CmdArgs.push_back(Args.MakeArgString("-include:___asan_seh_interceptor"));
     } else if (DLL) {
       addSanitizerRTWindows(getToolChain(), Args, CmdArgs,
                             "asan_dll_thunk-i386");
index fa02a4cff0bb123cd1ce8c30b4cd8ee5950c7920..5bd200117967b638057ade9c9d4fba0b071ac17e 100644 (file)
@@ -25,6 +25,7 @@
 // ASAN-MD: "-incremental:no"
 // ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
 // ASAN-MD: "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
+// ASAN-MD: "-include:___asan_seh_interceptor"
 // ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
 
 // RUN: %clang_cl /LD -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s