r242121 - Add support for -fuse-ld= in the mingw toolchain driver.

Yaron Keren via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 14 11:58:41 PST 2015


Filipe: with mingw targetting Windows/COFF files I think only ld and lld
makes sense as gold creates ELF files. I included Microsoft link.exe in the
mingw-useld test but rethinking, no one really uses that configuration, see
attached patch. Is that what you mean?

Rafael: running under Windows which has symbolic links but they aren't
really used as much (or at all) as under Linux. For example clang-cl.exe
and clang++.exe are copies (not links) of clang.exe.

Martell, what do you think?



2015-11-14 19:52 GMT+02:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:

> On 15 November 2015 at 02:39, Filipe Cabecinhas <filcab at gmail.com> wrote:
> > Handling of values other than lld looked weird.
> > Can you make it a hard error to use something other than, I guess, ld,
> gold,
> > lld?
> > Or are there other linkers available?
>
> What I find strange is that we use -flavor at all. We should ideally
> just be using different links to lld, like we do with "-fuse-ld=lld2".
>
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151114/3c43a5ca/attachment.html>
-------------- next part --------------
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp	(revision 253024)
+++ tools/clang/lib/Driver/Tools.cpp	(working copy)
@@ -9470,6 +9470,8 @@
   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())
Index: tools/clang/test/Driver/mingw-useld.c
===================================================================
--- tools/clang/test/Driver/mingw-useld.c	(revision 253069)
+++ tools/clang/test/Driver/mingw-useld.c	(working copy)
@@ -7,10 +7,6 @@
 // CHECK_LLD_32: lld" "-flavor" "gnu"
 // CHECK_LLD_32: "i386pe"
 
-// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=link.exe 2>&1 | FileCheck -check-prefix=CHECK_LINK_32 %s
-// CHECK_LINK_32: link.exe"
-// CHECK_LINK_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: lld" "-flavor" "gnu"
 // CHECK_LLD_64: "i386pep"


More information about the cfe-commits mailing list