r374754 - [clang] [clang-offload-bundler] Fix finding installed llvm-objcopy

Michal Gorny via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 13 22:33:24 PDT 2019


Author: mgorny
Date: Sun Oct 13 22:33:23 2019
New Revision: 374754

URL: http://llvm.org/viewvc/llvm-project?rev=374754&view=rev
Log:
[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

Modified:
    cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp

Modified: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp?rev=374754&r1=374753&r2=374754&view=diff
==============================================================================
--- cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp (original)
+++ cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp Sun Oct 13 22:33:23 2019
@@ -468,6 +468,8 @@ public:
     // Find llvm-objcopy in order to create the bundle binary.
     ErrorOr<std::string> 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;




More information about the cfe-commits mailing list