[PATCH] D39509: Vary Windows toolchain selection by -fused-ld
Dave Lee via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 1 14:31:39 PDT 2017
kastiglione updated this revision to Diff 121185.
kastiglione added a comment.
Use "link" as default when inspecting -fuse-ld=
https://reviews.llvm.org/D39509
Files:
lib/Driver/Driver.cpp
test/Driver/Inputs/Windows/usr/bin/ld.bfd
test/Driver/fuse-ld.c
Index: test/Driver/fuse-ld.c
===================================================================
--- test/Driver/fuse-ld.c
+++ test/Driver/fuse-ld.c
@@ -67,3 +67,23 @@
// RUN: -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD-TC
// CHECK-ANDROID-ARM-GOLD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.gold
+
+
+// RUN: %clang %s -### -fuse-ld=link \
+// RUN: -target i686-unknown-windows-msvc 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LINK
+// CHECK-WINDOWS-MSVC-LINK: "{{.*}}link.exe"
+// CHECK-WINDOWS-MSVC-LINK-SAME: "-out:{{.*}}"
+
+// 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:{{.*}}"
+
+// RUN: %clang %s -### -fuse-ld=bfd \
+// RUN: -target i686-unknown-windows-msvc \
+// RUN: -B %S/Inputs/Windows/usr/bin 2>&1 \
+// RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD
+// CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd"
+// CHECK-WINDOWS-MSVC-BFD-SAME: "-o"
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -3880,7 +3880,13 @@
break;
case llvm::Triple::MSVC:
case llvm::Triple::UnknownEnvironment:
- TC = llvm::make_unique<toolchains::MSVCToolChain>(*this, Target, Args);
+ const auto A = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "link");
+ if (A.equals_lower("link") || A.equals_lower("lld"))
+ TC =
+ llvm::make_unique<toolchains::MSVCToolChain>(*this, Target, Args);
+ else
+ TC = llvm::make_unique<toolchains::CrossWindowsToolChain>(
+ *this, Target, Args);
break;
}
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39509.121185.patch
Type: text/x-patch
Size: 1983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171101/72aee8c8/attachment-0001.bin>
More information about the cfe-commits
mailing list