[PATCH] D89702: [clang] [msvc] Automatically link against oldnames just as linking against libcmt
Martin Storsjö via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 19 08:10:50 PDT 2020
mstorsjo created this revision.
mstorsjo added reviewers: rnk, amccarth.
Herald added a project: clang.
mstorsjo requested review of this revision.
If invoking clang-cl, both libcmt (or another lib, depending on the /M[TD](|d) options) and oldnames are passed as dependent libs. If compiling and linking via the clang driver, we used to just pass libcmt when linking; include oldnames consistently there.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89702
Files:
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/msvc-link.c
Index: clang/test/Driver/msvc-link.c
===================================================================
--- clang/test/Driver/msvc-link.c
+++ 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"
Index: clang/lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -333,8 +333,10 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89702.299060.patch
Type: text/x-patch
Size: 1165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201019/bdad0ceb/attachment.bin>
More information about the cfe-commits
mailing list