Skip to content

Commit fe6a426

Browse files
committed
HIPSPV: Unbundle SDL
This fixes the issue of rdc linking static libraries with device code
1 parent 15f7e02 commit fe6a426

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/lib/Driver/ToolChains/HIPSPV.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ void HIPSPV::Linker::constructLinkAndEmitSpirvCommand(
7070

7171
// Link LLVM bitcode.
7272
ArgStringList LinkArgs{};
73+
74+
// Add static device libraries using the common helper function.
75+
// This handles unbundling archives (.a) containing bitcode bundles.
76+
const HIPSPVToolChain &TC = static_cast<const HIPSPVToolChain &>(getToolChain());
77+
StringRef Arch = TC.getTriple().getArchName();
78+
StringRef Target = "generic"; // SPIR-V is generic, no specific target ID like -mcpu
79+
tools::AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LinkArgs, Arch,
80+
Target, /*IsBitCodeSDL=*/true);
81+
7382
for (auto Input : Inputs)
7483
LinkArgs.push_back(Input.getFilename());
7584
LinkArgs.append({"-o", TempFile});

0 commit comments

Comments
 (0)