[clang] 8ea4aed - [OpenMP] Add search path for llvm-strip

Kelvin Li via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 19:17:29 PST 2022


Author: Kelvin Li
Date: 2022-02-04T22:15:14-05:00
New Revision: 8ea4aed50a9f84d9617219ccc936c005c5f31c24

URL: https://github.com/llvm/llvm-project/commit/8ea4aed50a9f84d9617219ccc936c005c5f31c24
DIFF: https://github.com/llvm/llvm-project/commit/8ea4aed50a9f84d9617219ccc936c005c5f31c24.diff

LOG: [OpenMP] Add search path for llvm-strip

Add the build directory to the search path for llvm-strip instead
of solely relying on the PATH environment variable setting.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D118965

Added: 
    

Modified: 
    clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index de0af187731d3..2f5ddb77b7b3f 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -310,7 +310,13 @@ extractFromBinary(const ObjectFile &Obj,
 
   // We will use llvm-strip to remove the now unneeded section containing the
   // offloading code.
-  ErrorOr<std::string> StripPath = sys::findProgramByName("llvm-strip");
+  void *P = (void *)(intptr_t)&Help;
+  StringRef COWDir = "";
+  auto COWPath = sys::fs::getMainExecutable("llvm-strip", P);
+  if (!COWPath.empty())
+    COWDir = sys::path::parent_path(COWPath);
+  ErrorOr<std::string> StripPath =
+      sys::findProgramByName("llvm-strip", {COWDir});
   if (!StripPath)
     return createStringError(StripPath.getError(),
                              "Unable to find 'llvm-strip' in path");


        


More information about the cfe-commits mailing list