Skip to content

Commit af213f3

Browse files
committed
[clang] recognize hexagon-*-ld.lld variants
If we create a cross toolchain with a ${triple}-ld.lld symlink, clang finds that symlink and when it uses it, it's not recognized as "lld". Let's consider it as lld as long as it ends in "ld.lld". For example, clang provides hexagon-link specific link arguments such as `-mcpu=hexagonv65` and `-march=hexagon` when hexagon-unknown-linux-musl-ld.lld is found. lld rejects this with the following error: hexagon-unknown-linux-musl-ld.lld: error: unknown emulation: cpu=hexagonv65
1 parent ff97b28 commit af213f3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/Driver/ToolChains/Hexagon.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
294294
bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles);
295295
bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs);
296296
bool UseG0 = false;
297-
const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
298-
bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") ||
299-
llvm::sys::path::stem(Exec).equals_insensitive("ld.lld"));
297+
bool UseLLD = false;
298+
const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD));
299+
UseLLD = UseLLD || llvm::sys::path::filename(Exec).endswith("ld.lld") ||
300+
llvm::sys::path::stem(Exec).endswith("ld.lld");
300301
bool UseShared = IsShared && !IsStatic;
301302
StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args);
302303

0 commit comments

Comments
 (0)