r216447 - [ASan/Win] Add an extra thunk.lib to handle stack-use-after-return option
Timur Iskhodzhanov
timurrrr at google.com
Tue Aug 26 03:08:24 PDT 2014
Author: timurrrr
Date: Tue Aug 26 05:08:24 2014
New Revision: 216447
URL: http://llvm.org/viewvc/llvm-project?rev=216447&view=rev
Log:
[ASan/Win] Add an extra thunk.lib to handle stack-use-after-return option
With this patch, "check-asan" passes all the tests with both MT and MD ASan RTL if you set COMPILER_RT_BUILD_SHARED_ASAN to ON
(PR20214)
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-link.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=216447&r1=216446&r2=216447&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Aug 26 05:08:24 2014
@@ -7820,7 +7820,10 @@ void visualstudio::Link::ConstructJob(Co
CmdArgs.push_back(Args.MakeArgString("-debug"));
CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
// FIXME: Handle 64-bit.
- if (DLL) {
+ if (Args.hasArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd)) {
+ addSanitizerRTWindows(getToolChain(), Args, CmdArgs, "asan_dynamic-i386");
+ addSanitizerRTWindows(getToolChain(), Args, CmdArgs, "asan_uar_thunk-i386");
+ } else if (DLL) {
addSanitizerRTWindows(getToolChain(), Args, CmdArgs,
"asan_dll_thunk-i386");
} else {
Modified: cfe/trunk/test/Driver/cl-link.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-link.c?rev=216447&r1=216446&r2=216447&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-link.c (original)
+++ cfe/trunk/test/Driver/cl-link.c Tue Aug 26 05:08:24 2014
@@ -19,6 +19,14 @@
// ASAN: "{{.*}}clang_rt.asan_cxx-i386.lib"
// ASAN: "{{.*}}cl-link{{.*}}.obj"
+// RUN: %clang_cl /MD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s
+// ASAN-MD: link.exe
+// ASAN-MD: "-debug"
+// ASAN-MD: "-incremental:no"
+// ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
+// ASAN-MD: "{{.*}}clang_rt.asan_uar_thunk-i386.lib"
+// ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
+
// RUN: %clang_cl /LD -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
// RUN: %clang_cl /LDd -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
// DLL: link.exe
More information about the cfe-commits
mailing list