Skip to content

Commit

Permalink
[OpenMP] Add search path for llvm-strip
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kkwli committed Feb 5, 2022
1 parent 0b7669f commit 8ea4aed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 8ea4aed

Please sign in to comment.