[PATCH] D37727: Driver: Remove custom MinGW linker detection
Martell Malone via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 12 05:15:27 PDT 2017
martell updated this revision to Diff 114801.
martell added a comment.
update tests
Repository:
rL LLVM
https://reviews.llvm.org/D37727
Files:
lib/Driver/ToolChains/MinGW.cpp
test/Driver/mingw-useld.c
Index: test/Driver/mingw-useld.c
===================================================================
--- test/Driver/mingw-useld.c
+++ test/Driver/mingw-useld.c
@@ -1,19 +1,19 @@
-// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_LD_32 %s
-// CHECK_LD_32: ld{{(.exe)?}}"
+// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=platform 2>&1 | FileCheck -check-prefix=CHECK_LD_32 %s
+// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
// CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "-flavor" "gnu"
+// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_32 %s
// CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
// CHECK_LLD_32: "i386pe"
// RUN: %clang -### -target x86_64-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_64 %s
// CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_64: "{{[^"]*}}ld.lld{{(.exe)?}}"
// CHECK_LLD_64: "i386pep"
// RUN: %clang -### -target arm-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_ARM %s
// CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_ARM: "{{[^"]*}}ld.lld{{(.exe)?}}"
// CHECK_LLD_ARM: "thumb2pe"
Index: lib/Driver/ToolChains/MinGW.cpp
===================================================================
--- lib/Driver/ToolChains/MinGW.cpp
+++ lib/Driver/ToolChains/MinGW.cpp
@@ -104,14 +104,6 @@
// handled somewhere else.
Args.ClaimAllArgs(options::OPT_w);
- StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
- if (LinkerName.equals_lower("lld")) {
- CmdArgs.push_back("-flavor");
- CmdArgs.push_back("gnu");
- } else if (!LinkerName.equals_lower("ld")) {
- D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
- }
-
if (!D.SysRoot.empty())
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
@@ -241,7 +233,7 @@
if (Args.hasArg(options::OPT_static))
CmdArgs.push_back("--end-group");
- else if (!LinkerName.equals_lower("lld"))
+ else
AddLibGCC(Args, CmdArgs);
}
@@ -252,7 +244,7 @@
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
}
}
- const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
+ const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37727.114801.patch
Type: text/x-patch
Size: 2908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170912/73738fa7/attachment-0001.bin>
More information about the cfe-commits
mailing list