https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/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) >From 1bd145620500dc7ff740056e494093c2de7f0ef7 Mon Sep 17 00:00:00 2001 From: Joseph Huber <[email protected]> Date: Mon, 28 Jul 2025 09:54:21 -0500 Subject: [PATCH] [Clang] Search for 'offload-arch' only next to the clang driver 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) --- clang/lib/Driver/Driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
