From: Timur Iskhodzhanov Date: Fri, 12 Sep 2014 14:01:30 +0000 (+0000) Subject: [ASan/Win] Fix PR20918 -- SEH handler doesn't work with the MD runtime X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cecb89c7bd7b7b1f9148e56469ce3f057e6e49a9;p=clang [ASan/Win] Fix PR20918 -- SEH handler doesn't work with the MD runtime git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217679 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 7fb1a1a33c..0e1dea2a97 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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"); diff --git a/test/Driver/cl-link.c b/test/Driver/cl-link.c index fa02a4cff0..5bd2001179 100644 --- a/test/Driver/cl-link.c +++ b/test/Driver/cl-link.c @@ -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