Skip to content

Commit 2ffb36e

Browse files
committedJul 14, 2015
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 llvm-svn: 242121
1 parent ae5d78d commit 2ffb36e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎clang/lib/Driver/Tools.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -8947,6 +8947,12 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
89478947
// handled somewhere else.
89488948
Args.ClaimAllArgs(options::OPT_w);
89498949

8950+
StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
8951+
if (LinkerName.equals_lower("lld")) {
8952+
CmdArgs.push_back("-flavor");
8953+
CmdArgs.push_back("gnu");
8954+
}
8955+
89508956
if (!D.SysRoot.empty())
89518957
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
89528958

@@ -8958,6 +8964,8 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
89588964
CmdArgs.push_back("i386pe");
89598965
if (TC.getArch() == llvm::Triple::x86_64)
89608966
CmdArgs.push_back("i386pep");
8967+
if (TC.getArch() == llvm::Triple::arm)
8968+
CmdArgs.push_back("thumb2pe");
89618969

89628970
if (Args.hasArg(options::OPT_mwindows)) {
89638971
CmdArgs.push_back("--subsystem");
@@ -9067,7 +9075,7 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
90679075

90689076
if (Args.hasArg(options::OPT_static))
90699077
CmdArgs.push_back("--end-group");
9070-
else
9078+
else if (!LinkerName.equals_lower("lld"))
90719079
AddLibGCC(Args, CmdArgs);
90729080
}
90739081

@@ -9078,7 +9086,7 @@ void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
90789086
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
90799087
}
90809088
}
9081-
const char *Exec = Args.MakeArgString(TC.GetProgramPath("ld"));
9089+
const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
90829090
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs));
90839091
}
90849092

0 commit comments

Comments
 (0)
Please sign in to comment.