[clang] [Clang] Search for 'offload-arch' only next to the clang driver (PR #150965)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 28 07:57:13 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
Summary:
Previously, querying for the offload architecture tool would invoke the
user's PATH, which is bad when potentially using the driver from a
direct path. This patch change this to *only* consider the
`offload-arch` that's supposed to live next to the driver executable.
Now we will no longer pick up a potentially conflicting version of this
tool and it should always be found (Since it's a clang tool that's
installazed alongside the driver)
---
Full diff: https://github.com/llvm/llvm-project/pull/150965.diff
1 Files Affected:
- (modified) clang/lib/Driver/Driver.cpp (+1-1)
``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 853f694850ba8..b90bd1d9ea17b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -910,7 +910,7 @@ getSystemOffloadArchs(Compilation &C, Action::OffloadKind Kind) {
SmallVector<std::string> GPUArchs;
if (llvm::ErrorOr<std::string> Executable =
- llvm::sys::findProgramByName(Program)) {
+ llvm::sys::findProgramByName(Program, {C.getDriver().Dir})) {
llvm::SmallVector<StringRef> Args{*Executable};
if (Kind == Action::OFK_HIP)
Args.push_back("--only=amdgpu");
``````````
</details>
https://github.com/llvm/llvm-project/pull/150965
More information about the cfe-commits
mailing list