aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2025-07-28 11:36:31 -0500
committerGitHub <noreply@github.com>2025-07-28 11:36:31 -0500
commit4f58c829fd8473b11c2e6c6ee424b2432e02fb56 (patch)
treeea027897946cf437f2b3e19ee9d7a44b0ebeab94
parent0121a8e4319619527c9c28bbc01c74f794cc2255 (diff)
downloadllvm-4f58c829fd8473b11c2e6c6ee424b2432e02fb56.zip
llvm-4f58c829fd8473b11c2e6c6ee424b2432e02fb56.tar.gz
llvm-4f58c829fd8473b11c2e6c6ee424b2432e02fb56.tar.bz2
[Clang] Search for 'offload-arch' only next to the clang driver (#150965)
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)
-rw-r--r--clang/lib/Driver/Driver.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 853f694..b90bd1d 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");