[PATCH] D69760: [Clang][Driver] Don't pun -fuse-ld=lld as -fuse-ld=lld-link with msvc
John Ericson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 3 09:16:59 PST 2019
Ericson2314 updated this revision to Diff 227621.
Ericson2314 retitled this revision from "Better clang cross windows with gnu-style flags" to "Clang][Driver] Don't pun -fuse-ld=lld as -fuse-ld=lld-link with msvc".
Ericson2314 edited the summary of this revision.
Ericson2314 added a comment.
Split out some changes into other diffs. 1 we are stacked on, the other 2 are independent and not stacked on,
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69760/new/
https://reviews.llvm.org/D69760
Files:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/fuse-ld.c
Index: clang/test/Driver/fuse-ld.c
===================================================================
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -79,8 +79,13 @@
// RUN: %clang %s -### -fuse-ld=lld \
// RUN: -target i686-unknown-windows-msvc 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LLD
-// CHECK-WINDOWS-MSVC-LLD: "{{.*}}lld-link"
-// CHECK-WINDOWS-MSVC-LLD-SAME: "-out:{{.*}}"
+// CHECK-WINDOWS-MSVC-LLD: "{{.*}}ld.lld"
+// CHECK-WINDOWS-MSVC-LLD-SAME: "-o"
+
+// RUN: %clang-cl %s -### -fuse-ld=lld \
+// RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LLD
+// CHECK-cl-WINDOWS-MSVC-LLD: "{{.*}}ld.lld"
+// CHECK-cl-WINDOWS-MSVC-LLD-SAME: "-o"
// RUN: %clang %s -### -fuse-ld=lld-link \
// RUN: -target i686-unknown-windows-msvc 2>&1 \
Index: clang/lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -490,13 +490,10 @@
std::vector<const char *> Environment;
- // We need to special case some linker paths. In the case of lld, we need to
- // translate 'lld' into 'lld-link', and in the case of the regular msvc
+ // We need to special case some linker paths. In the case of the regular msvc
// linker, we need to use a special search algorithm.
llvm::SmallString<128> linkPath;
StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "link");
- if (Linker.equals_lower("lld"))
- Linker = "lld-link";
if (Linker.equals_lower("link")) {
// If we're using the MSVC linker, it's not sufficient to just use link
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4785,8 +4785,8 @@
break;
case llvm::Triple::MSVC:
case llvm::Triple::UnknownEnvironment:
- if (Args.getLastArgValue(options::OPT_fuse_ld_EQ)
- .startswith_lower("bfd"))
+ auto linkerFlavor = Args.getLastArgValue(options::OPT_fuse_ld_EQ);
+ if (linkerFlavor.startswith_lower("bfd") || linkerFlavor.equals_lower("lld")
TC = std::make_unique<toolchains::CrossWindowsToolChain>(
*this, Target, Args);
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69760.227621.patch
Type: text/x-patch
Size: 2326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191103/e1e260a7/attachment.bin>
More information about the cfe-commits
mailing list