Skip to content

Commit 2b94f6d

Browse files
committed
[Xtensa]: Add '-fuse-ld' option support to ESP Xtensa toolchain
1 parent 1480947 commit 2b94f6d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

clang/lib/Driver/ToolChains/Xtensa.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ void Xtensa::Linker::ConstructJob(Compilation &C, const JobAction &JA,
210210
const ArgList &Args,
211211
const char *LinkingOutput) const {
212212
ArgStringList CmdArgs;
213+
SmallString<128> Linker;
213214
bool WantCRTs =
214215
!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
215216
const auto &ToolChain =
@@ -218,9 +219,13 @@ void Xtensa::Linker::ConstructJob(Compilation &C, const JobAction &JA,
218219
if (ToolChain.GCCToolchainName == "")
219220
llvm_unreachable("Unable to find Xtensa GCC linker");
220221

221-
SmallString<128> Linker(ToolChain.GCCToolchainDir);
222-
llvm::sys::path::append(Linker, "bin",
223-
ToolChain.GCCToolchainName + "-" + getShortName());
222+
if (Args.hasArg(options::OPT_fuse_ld_EQ)) {
223+
Linker.assign(ToolChain.GetLinkerPath());
224+
} else {
225+
Linker.assign(ToolChain.GCCToolchainDir);
226+
llvm::sys::path::append(Linker, "bin",
227+
ToolChain.GCCToolchainName + "-" + getShortName());
228+
}
224229

225230
const char *crtbegin, *crtend;
226231
auto RuntimeLib = ToolChain.GetRuntimeLibType(Args);

0 commit comments

Comments
 (0)