Skip to content

Commit 17496a8

Browse files
committed
[Xtensa] Make it possible to use -fuse-ld when GCC toolchain is detected
1 parent 7c941f4 commit 17496a8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

clang/lib/Driver/ToolChains/Xtensa.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,18 @@ void xtensa::Linker::ConstructJob(Compilation &C, const JobAction &JA,
287287
if (!D.SysRoot.empty())
288288
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
289289

290+
bool LinkerIsLLD;
291+
std::string LinkerPath = ToolChain.GetLinkerPath(&LinkerIsLLD);
290292
if (ToolChain.GCCToolchainName != "") {
291-
Linker.assign(ToolChain.GCCToolchainDir);
292-
llvm::sys::path::append(Linker, "bin",
293-
ToolChain.GCCToolchainName + "-" + getShortName());
293+
if (!LinkerIsLLD) {
294+
Linker.assign(ToolChain.GCCToolchainDir);
295+
llvm::sys::path::append(
296+
Linker, "bin", ToolChain.GCCToolchainName + "-" + getShortName());
297+
} else {
298+
Linker.assign(LinkerPath);
299+
}
294300
} else {
295-
Linker.assign(ToolChain.GetLinkerPath());
301+
Linker.assign(LinkerPath);
296302
}
297303

298304
const char *crtbegin, *crtend;

0 commit comments

Comments
 (0)