[PATCH] D60094: [MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next to cl.exe
Martin Storsjö via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 19 12:02:46 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rC358778: [MSVC] If unable to find link.exe from a MSVC installation, look for link.exe… (authored by mstorsjo, committed by ).
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60094/new/
https://reviews.llvm.org/D60094
Files:
lib/Driver/ToolChains/MSVC.cpp
Index: lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -488,8 +488,18 @@
// their own link.exe which may come first.
linkPath = FindVisualStudioExecutable(TC, "link.exe");
- if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath))
- C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
+ if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath)) {
+ llvm::SmallString<128> ClPath;
+ ClPath = TC.GetProgramPath("cl.exe");
+ if (llvm::sys::fs::can_execute(ClPath)) {
+ linkPath = llvm::sys::path::parent_path(ClPath);
+ llvm::sys::path::append(linkPath, "link.exe");
+ if (!llvm::sys::fs::can_execute(linkPath))
+ C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
+ } else {
+ C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
+ }
+ }
#ifdef _WIN32
// When cross-compiling with VS2017 or newer, link.exe expects to have
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60094.195895.patch
Type: text/x-patch
Size: 1082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190419/e1328e90/attachment.bin>
More information about the cfe-commits
mailing list