Skip to content

Commit c37c24a

Browse files
authored
[clang][Driver] SPIRVAMDToolChain must not require device libs. (#171815)
Prior to these changes, the SPIRVAMDToolChain was looking for device libs and failing. This is fixed by not looking for device libs (for SPIR-V). The device libs are never linked for SPIR-V.
1 parent 1e57119 commit c37c24a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,10 @@ void ROCMToolChain::addClangTargetOptions(
967967
true))
968968
return;
969969

970+
// For SPIR-V (SPIRVAMDToolChain) we must not link any device libraries so we
971+
// skip it.
972+
if (this->getEffectiveTriple().isSPIRV())
973+
return;
970974
// Get the device name and canonicalize it
971975
const StringRef GpuArch = getGPUArch(DriverArgs);
972976
auto Kind = llvm::AMDGPU::parseArchAMDGCN(GpuArch);

clang/test/Driver/spirv-amd-toolchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// BINDINGS: # "spirv64-amd-amdhsa" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[OUTPUT:.+]]"
1313
// BINDINGS: # "spirv64-amd-amdhsa" - "AMDGCN::Linker", inputs: ["[[OUTPUT]]"], output: "a.out"
1414

15-
// RUN: %clang -### --target=spirv64-amd-amdhsa %s -nogpulib -nogpuinc 2>&1 \
15+
// RUN: %clang -### --target=spirv64-amd-amdhsa %s 2>&1 \
1616
// RUN: | FileCheck %s --check-prefix=INVOCATION
1717
// INVOCATION: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-disable-llvm-optzns" {{.*}} "-o" "[[OUTPUT:.+]]" "-x" "c"
1818
// INVOCATION: "{{.*}}llvm-link" "-o" "[[LINKED_OUTPUT:.+]]" "[[OUTPUT]]"

0 commit comments

Comments
 (0)