Skip to content

Conversation

@llvmbot
Copy link
Member

@llvmbot llvmbot commented Nov 30, 2024

Backport 2dc0de7

Requested by: @androm3da

@llvmbot llvmbot added this to the LLVM 19.X Release milestone Nov 30, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Nov 30, 2024

@MaskRay What do you think about merging this PR to the release branch?

@llvmbot llvmbot requested a review from MaskRay November 30, 2024 17:01
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:Hexagon clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 30, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Nov 30, 2024

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-backend-hexagon

Author: None (llvmbot)

Changes

Backport 2dc0de7

Requested by: @androm3da


Full diff: https://github.com/llvm/llvm-project/pull/118181.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Hexagon.cpp (+4-3)
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);
 

@androm3da
Copy link
Member

ping @MaskRay

@tru tru merged commit ab4b5a2 into llvm:release/19.x Dec 3, 2024
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)
@github-actions
Copy link

github-actions bot commented Dec 3, 2024

@androm3da (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:Hexagon clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

Development

Successfully merging this pull request may close these issues.

4 participants