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

Filipe Cabecinhas via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 14 09:39:03 PST 2015


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?

  Filipe

On Friday, 13 November 2015, Yaron Keren via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Sure, r253066.
>
>
> 2015-11-13 19:40 GMT+02:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com
> <javascript:_e(%7B%7D,'cvml','rafael.espindola at gmail.com');>>:
>
>> This needs a testcase. Nothing is checking the linker invocation.
>>
>> On 14 July 2015 at 01:23, Yaron Keren <yaron.keren at gmail.com
>> <javascript:_e(%7B%7D,'cvml','yaron.keren at gmail.com');>> wrote:
>> > Author: yrnkrn
>> > Date: Tue Jul 14 00:23:34 2015
>> > New Revision: 242121
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=242121&view=rev
>> > Log:
>> > Add support for -fuse-ld= in the mingw toolchain driver.
>> > We will still default to ld until such a time lld become a
>> > stable release. lld supports arm NT under the machine name "thumb2pe".
>> >
>> > http://reviews.llvm.org/D11088
>> >
>> > Patch by Martell Malone
>> > Reviewed by Reid Kleckner
>> >
>> >
>> > Modified:
>> >     cfe/trunk/lib/Driver/Tools.cpp
>> >
>> > Modified: cfe/trunk/lib/Driver/Tools.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242121&r1=242120&r2=242121&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> > +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 14 00:23:34 2015
>> > @@ -8947,6 +8947,12 @@ void MinGW::Linker::ConstructJob(Compila
>> >    // 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");
>> > +  }
>> > +
>> >    if (!D.SysRoot.empty())
>> >      CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>> >
>> > @@ -8958,6 +8964,8 @@ void MinGW::Linker::ConstructJob(Compila
>> >      CmdArgs.push_back("i386pe");
>> >    if (TC.getArch() == llvm::Triple::x86_64)
>> >      CmdArgs.push_back("i386pep");
>> > +  if (TC.getArch() == llvm::Triple::arm)
>> > +    CmdArgs.push_back("thumb2pe");
>> >
>> >    if (Args.hasArg(options::OPT_mwindows)) {
>> >      CmdArgs.push_back("--subsystem");
>> > @@ -9067,7 +9075,7 @@ void MinGW::Linker::ConstructJob(Compila
>> >
>> >        if (Args.hasArg(options::OPT_static))
>> >          CmdArgs.push_back("--end-group");
>> > -      else
>> > +      else if (!LinkerName.equals_lower("lld"))
>> >          AddLibGCC(Args, CmdArgs);
>> >      }
>> >
>> > @@ -9078,7 +9086,7 @@ void MinGW::Linker::ConstructJob(Compila
>> >
>> CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
>> >      }
>> >    }
>> > -  const char *Exec = Args.MakeArgString(TC.GetProgramPath("ld"));
>> > +  const char *Exec =
>> Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
>> >    C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs));
>> >  }
>> >
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> <javascript:_e(%7B%7D,'cvml','cfe-commits at cs.uiuc.edu');>
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>

-- 
  F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151114/17d26a24/attachment.html>


More information about the cfe-commits mailing list