[clang] cdbf6bf - [HIP] Use argv[0] as the default choice for the Executable name.
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 3 10:32:45 PST 2020
Author: Artem Belevich
Date: 2020-11-03T10:31:39-08:00
New Revision: cdbf6bfdc7d15fc6a078c7773f142042a11d2c1b
URL: https://github.com/llvm/llvm-project/commit/cdbf6bfdc7d15fc6a078c7773f142042a11d2c1b
DIFF: https://github.com/llvm/llvm-project/commit/cdbf6bfdc7d15fc6a078c7773f142042a11d2c1b.diff
LOG: [HIP] Use argv[0] as the default choice for the Executable name.
The path produced by getMainExecutable() may not be the right one when the files are installed in
a symlinked tree and when the real location of llvm-objdump is in a different directory.
Given that clang-offload-bundler is invoked by clang, the driver already does the job figuring out
the right path (e.g. it pays attention to -no-canonical-prefixes).
Offload bundler should use it, instead of trying to figure out the path on its
own.
Differential Revision: https://reviews.llvm.org/D90436
Added:
Modified:
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
index e4a32d5e8744..44c46a89a859 100644
--- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -1025,7 +1025,9 @@ int main(int argc, const char **argv) {
// Save the current executable directory as it will be useful to find other
// tools.
- BundlerExecutable = sys::fs::getMainExecutable(argv[0], &BundlerExecutable);
+ BundlerExecutable = argv[0];
+ if (!llvm::sys::fs::exists(BundlerExecutable))
+ BundlerExecutable = sys::fs::getMainExecutable(argv[0], &BundlerExecutable);
if (llvm::Error Err = Unbundle ? UnbundleFiles() : BundleFiles()) {
reportError(std::move(Err));
More information about the cfe-commits
mailing list