Skip to content

Commit 5eece13

Browse files
committed
[clang] Automatically link against oldnames just as linking against libcmt
Differential Revision: https://reviews.llvm.org/D89702
1 parent 0ddf4bd commit 5eece13

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,10 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
333333
Args.MakeArgString(std::string("-out:") + Output.getFilename()));
334334

335335
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles) &&
336-
!C.getDriver().IsCLMode())
336+
!C.getDriver().IsCLMode()) {
337337
CmdArgs.push_back("-defaultlib:libcmt");
338+
CmdArgs.push_back("-defaultlib:oldnames");
339+
}
338340

339341
if (!llvm::sys::Process::GetEnv("LIB")) {
340342
// If the VC environment hasn't been configured (perhaps because the user

clang/test/Driver/msvc-link.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// BASIC: link.exe"
33
// BASIC: "-out:a.exe"
44
// BASIC: "-defaultlib:libcmt"
5+
// BASIC: "-defaultlib:oldnames"
56
// BASIC: "-nologo"
67
// BASIC-NOT: "-Brepro"
78

89
// RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s
910
// DLL: link.exe"
1011
// DLL: "-out:a.dll"
1112
// DLL: "-defaultlib:libcmt"
13+
// DLL: "-defaultlib:oldnames"
1214
// DLL: "-nologo"
1315
// DLL: "-dll"
1416

0 commit comments

Comments
 (0)