https://github.com/pvelesko updated https://github.com/llvm/llvm-project/pull/136412
>From fe6a426fc135c7232650b5ebac465ceaa66d7a20 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang/lib/Driver/ToolChains/HIPSPV.cpp b/clang/lib/Driver/ToolChains/HIPSPV.cpp index bbde5c047c3f9..eaf20f34edb72 100644 --- a/clang/lib/Driver/ToolChains/HIPSPV.cpp +++ b/clang/lib/Driver/ToolChains/HIPSPV.cpp @@ -70,6 +70,15 @@ 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); + 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