Skip to content

Commit 8871e9e

Browse files
authored
[clang][Driver] Handle ROCm installation layout of lib/llvm/bin/clang (llvm#138928)
Committing on behalf of @stellaraccident
1 parent b641509 commit 8871e9e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,15 @@ RocmInstallationDetector::getInstallationPathCandidates() {
243243

244244
// Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
245245
// Some versions of the aomp package install to /opt/rocm/aomp/bin
246-
if (ParentName == "llvm" || ParentName.starts_with("aomp"))
246+
if (ParentName == "llvm" || ParentName.starts_with("aomp")) {
247247
ParentDir = llvm::sys::path::parent_path(ParentDir);
248+
ParentName = llvm::sys::path::filename(ParentDir);
249+
250+
// Some versions of the rocm llvm package install to
251+
// /opt/rocm/lib/llvm/bin, so also back up if within the lib dir still
252+
if (ParentName == "lib")
253+
ParentDir = llvm::sys::path::parent_path(ParentDir);
254+
}
248255

249256
return Candidate(ParentDir.str(), /*StrictChecking=*/true);
250257
};

0 commit comments

Comments
 (0)