Skip to content

Commit ab4b5a2

Browse files
androm3datru
authored andcommitted
[clang] recognize hexagon-*-ld.lld variants (#117338)
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 resolve that symlink and consider it when determining lld-ness. 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 (cherry picked from commit 2dc0de7)
1 parent 876d050 commit ab4b5a2

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).ends_with("ld.lld") ||
300+
llvm::sys::path::stem(Exec).ends_with("ld.lld");
300301
bool UseShared = IsShared && !IsStatic;
301302
StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args);
302303

0 commit comments

Comments
 (0)