Skip to content

Commit 4174525

Browse files
committed
Make sure -only-needed is used at llvm-link for SYCLDeviceLibs
1 parent 84292e9 commit 4174525

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ const char *SYCL::Linker::constructLLVMLinkCommand(
170170
LibPostfix = ".obj";
171171
std::string FileName = this->getToolChain().getInputFilename(II);
172172
StringRef InputFilename = llvm::sys::path::filename(FileName);
173+
if (this->getToolChain().getTriple().isNVPTX()) {
174+
// Linking SYCL Device libs requires libclc as well as libdevice
175+
if ((InputFilename.find("nvidiacl") != InputFilename.npos ||
176+
InputFilename.find("libdevice") != InputFilename.npos))
177+
return true;
178+
LibPostfix = ".cubin";
179+
}
173180
StringRef LibSyclPrefix("libsycl-");
174181
if (!InputFilename.startswith(LibSyclPrefix) ||
175182
!InputFilename.endswith(LibPostfix) || (InputFilename.count('-') < 2))

0 commit comments

Comments
 (0)