Fix default cross-linker for MSVC targets on non-Windows hosts (#3282)

Fixes an annoyance reported in #3281, affecting non-LLD-enabled builds
as well as linker invocations involving LTO.
This commit is contained in:
Martin Kinkelin 2020-01-16 11:56:54 +01:00 committed by GitHub
parent 540d02376c
commit cef4b3d6ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,8 +247,12 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath,
// try to call linker
std::string linker = opts::linker;
if (linker.empty()) {
#ifdef _WIN32
// default to lld-link.exe for LTO
linker = opts::isUsingLTO() ? "lld-link.exe" : "link.exe";
#else
linker = "lld-link";
#endif
}
return executeToolAndWait(linker, args, global.params.verbose);