https://github.com/pvelesko created https://github.com/llvm/llvm-project/pull/136412
This fixes the issue of rdc linking static libraries with device code >From 4a569a2b71cec13771c6b0695f732e721efcad82 Mon Sep 17 00:00:00 2001 From: Paulius Velesko <pvele...@pglc.io> Date: Sat, 19 Apr 2025 10:02:59 +0300 Subject: [PATCH] HIPSPV: Unbundle SDL This fixes the issue of rdc linking static libraries with device code --- clang/lib/Driver/ToolChains/HIPSPV.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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}); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits