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

Rafael EspĂ­ndola via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 09:40:02 PST 2015


This needs a testcase. Nothing is checking the linker invocation.

On 14 July 2015 at 01:23, Yaron Keren <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
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list