Skip to content

Commit 4a569a2

Browse files
committed
HIPSPV: Unbundle SDL
This fixes the issue of rdc linking static libraries with device code
1 parent 1c4ff51 commit 4a569a2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang/lib/Driver/ToolChains/HIPSPV.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ 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+
/*PostClangLink=*/false);
82+
7383
for (auto Input : Inputs)
7484
LinkArgs.push_back(Input.getFilename());
7585
LinkArgs.append({"-o", TempFile});

0 commit comments

Comments
 (0)