r285820 - [asan] Use the dynamic ASan runtime if -shared-libasan is passed

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 08:38:51 PDT 2016


Author: rnk
Date: Wed Nov  2 10:38:51 2016
New Revision: 285820

URL: http://llvm.org/viewvc/llvm-project?rev=285820&view=rev
Log:
[asan] Use the dynamic ASan runtime if -shared-libasan is passed

-shared-libasan is likely to be used as a link flag if the user is using
the GCC-style clang driver.

This logic is already tested in clang-cl tests, and the new flag to
exercise it will be covered by asan tests.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=285820&r1=285819&r2=285820&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov  2 10:38:51 2016
@@ -10786,7 +10786,8 @@ void visualstudio::Linker::ConstructJob(
   if (TC.getSanitizerArgs().needsAsanRt()) {
     CmdArgs.push_back(Args.MakeArgString("-debug"));
     CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
-    if (Args.hasArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd)) {
+    if (TC.getSanitizerArgs().needsSharedAsanRt() ||
+        Args.hasArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd)) {
       for (const auto &Lib : {"asan_dynamic", "asan_dynamic_runtime_thunk"})
         CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
       // Make sure the dynamic runtime thunk is not optimized out at link time




More information about the cfe-commits mailing list