[clang] 8871e9e - [clang][Driver] Handle ROCm installation layout of lib/llvm/bin/clang (#138928)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 27 07:04:14 PST 2025
Author: Jacob Lambert
Date: 2025-11-27T10:04:07-05:00
New Revision: 8871e9e2e2c0941b04b22f719906a588fe523be2
URL: https://github.com/llvm/llvm-project/commit/8871e9e2e2c0941b04b22f719906a588fe523be2
DIFF: https://github.com/llvm/llvm-project/commit/8871e9e2e2c0941b04b22f719906a588fe523be2.diff
LOG: [clang][Driver] Handle ROCm installation layout of lib/llvm/bin/clang (#138928)
Committing on behalf of @stellaraccident
Added:
Modified:
clang/lib/Driver/ToolChains/AMDGPU.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 80e58d466b885..87ccd40372681 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -243,8 +243,15 @@ RocmInstallationDetector::getInstallationPathCandidates() {
// Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
// Some versions of the aomp package install to /opt/rocm/aomp/bin
- if (ParentName == "llvm" || ParentName.starts_with("aomp"))
+ if (ParentName == "llvm" || ParentName.starts_with("aomp")) {
ParentDir = llvm::sys::path::parent_path(ParentDir);
+ ParentName = llvm::sys::path::filename(ParentDir);
+
+ // Some versions of the rocm llvm package install to
+ // /opt/rocm/lib/llvm/bin, so also back up if within the lib dir still
+ if (ParentName == "lib")
+ ParentDir = llvm::sys::path::parent_path(ParentDir);
+ }
return Candidate(ParentDir.str(), /*StrictChecking=*/true);
};
More information about the cfe-commits
mailing list