[clang] 5eece13 - [clang] Automatically link against oldnames just as linking against libcmt

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 19 14:07:22 PDT 2020


Author: Martin Storsjö
Date: 2020-10-20T00:07:00+03:00
New Revision: 5eece137bc76f349cefc8922447694bea29ae101

URL: https://github.com/llvm/llvm-project/commit/5eece137bc76f349cefc8922447694bea29ae101
DIFF: https://github.com/llvm/llvm-project/commit/5eece137bc76f349cefc8922447694bea29ae101.diff

LOG: [clang] Automatically link against oldnames just as linking against libcmt

Differential Revision: https://reviews.llvm.org/D89702

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/MSVC.cpp
    clang/test/Driver/msvc-link.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index ba2c7146b924..1e04cc9f6271 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -333,8 +333,10 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
         Args.MakeArgString(std::string("-out:") + Output.getFilename()));
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles) &&
-      !C.getDriver().IsCLMode())
+      !C.getDriver().IsCLMode()) {
     CmdArgs.push_back("-defaultlib:libcmt");
+    CmdArgs.push_back("-defaultlib:oldnames");
+  }
 
   if (!llvm::sys::Process::GetEnv("LIB")) {
     // If the VC environment hasn't been configured (perhaps because the user

diff  --git a/clang/test/Driver/msvc-link.c b/clang/test/Driver/msvc-link.c
index e3829e6651e3..13dccd21bfd8 100644
--- a/clang/test/Driver/msvc-link.c
+++ b/clang/test/Driver/msvc-link.c
@@ -2,6 +2,7 @@
 // BASIC: link.exe"
 // BASIC: "-out:a.exe"
 // BASIC: "-defaultlib:libcmt"
+// BASIC: "-defaultlib:oldnames"
 // BASIC: "-nologo"
 // BASIC-NOT: "-Brepro"
 
@@ -9,6 +10,7 @@
 // DLL: link.exe"
 // DLL: "-out:a.dll"
 // DLL: "-defaultlib:libcmt"
+// DLL: "-defaultlib:oldnames"
 // DLL: "-nologo"
 // DLL: "-dll"
 


        


More information about the cfe-commits mailing list