[clang] HIPSPV: Unbundle SDL (PR #136412)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 19 00:06:52 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Paulius Velesko (pvelesko)
<details>
<summary>Changes</summary>
This fixes the issue of rdc linking static libraries with device code
---
Full diff: https://github.com/llvm/llvm-project/pull/136412.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChains/HIPSPV.cpp (+10)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/HIPSPV.cpp b/clang/lib/Driver/ToolChains/HIPSPV.cpp
index bbde5c047c3f9..9d227ca6fa1c8 100644
--- a/clang/lib/Driver/ToolChains/HIPSPV.cpp
+++ b/clang/lib/Driver/ToolChains/HIPSPV.cpp
@@ -70,6 +70,16 @@ void HIPSPV::Linker::constructLinkAndEmitSpirvCommand(
// Link LLVM bitcode.
ArgStringList LinkArgs{};
+
+ // Add static device libraries using the common helper function.
+ // This handles unbundling archives (.a) containing bitcode bundles.
+ const HIPSPVToolChain &TC = static_cast<const HIPSPVToolChain &>(getToolChain());
+ StringRef Arch = TC.getTriple().getArchName();
+ StringRef Target = "generic"; // SPIR-V is generic, no specific target ID like -mcpu
+ tools::AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LinkArgs, Arch,
+ Target, /*IsBitCodeSDL=*/true,
+ /*PostClangLink=*/false);
+
for (auto Input : Inputs)
LinkArgs.push_back(Input.getFilename());
LinkArgs.append({"-o", TempFile});
``````````
</details>
https://github.com/llvm/llvm-project/pull/136412
More information about the cfe-commits
mailing list