[llvm-branch-commits] [clang] ab4b5a2 - [clang] recognize hexagon-*-ld.lld variants (#117338)
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 2 23:45:57 PST 2024
Author: Brian Cain
Date: 2024-12-03T08:46:10+01:00
New Revision: ab4b5a2db582958af1ee308a790cfdb42bd24720
URL: https://github.com/llvm/llvm-project/commit/ab4b5a2db582958af1ee308a790cfdb42bd24720
DIFF: https://github.com/llvm/llvm-project/commit/ab4b5a2db582958af1ee308a790cfdb42bd24720.diff
LOG: [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 2dc0de753b6df83e35f3d98e0e6a26c95e3399c0)
Added:
Modified:
clang/lib/Driver/ToolChains/Hexagon.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
index 29781399cbab44..be7851adecea66 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -294,9 +294,10 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles);
bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs);
bool UseG0 = false;
- const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
- bool UseLLD = (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") ||
- llvm::sys::path::stem(Exec).equals_insensitive("ld.lld"));
+ bool UseLLD = false;
+ const char *Exec = Args.MakeArgString(HTC.GetLinkerPath(&UseLLD));
+ UseLLD = UseLLD || llvm::sys::path::filename(Exec).ends_with("ld.lld") ||
+ llvm::sys::path::stem(Exec).ends_with("ld.lld");
bool UseShared = IsShared && !IsStatic;
StringRef CpuVer = toolchains::HexagonToolChain::GetTargetCPUVersion(Args);
More information about the llvm-branch-commits
mailing list