From 604dda360a6d644c4f3f046b2e73b9581e37dd30 Mon Sep 17 00:00:00 2001 From: Michal Gorny Date: Mon, 14 Oct 2019 05:33:23 +0000 Subject: [clang] [clang-offload-bundler] Fix finding installed llvm-objcopy Allow finding installed llvm-objcopy in PATH if it's not present in the directory containing clang-offload-bundler. This is the case if clang is being built stand-alone, and llvm-objcopy is already installed while the c-o-b tool is still present in build directory. This is consistent with how e.g. llvm-symbolizer is found in LLVM. However, most of similar searches in LLVM and Clang are performed without special-casing the program directory. Fixes r369955. Differential Revision: https://reviews.llvm.org/D68931 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374754 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/clang-offload-bundler/ClangOffloadBundler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/tools/clang-offload-bundler/ClangOffloadBundler.cpp index 19325e4a33..72def7756d 100644 --- a/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -468,6 +468,8 @@ public: // Find llvm-objcopy in order to create the bundle binary. ErrorOr Objcopy = sys::findProgramByName( "llvm-objcopy", sys::path::parent_path(BundlerExecutable)); + if (!Objcopy) + Objcopy = sys::findProgramByName("llvm-objcopy"); if (!Objcopy) { errs() << "error: unable to find 'llvm-objcopy' in path.\n"; return true; -- cgit v1.2.1