Skip to content

Commit 14c432b

Browse files
kkwlitstellar
authored andcommitted
[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 (cherry picked from commit 8ea4aed)
1 parent 453361d commit 14c432b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,13 @@ extractFromBinary(const ObjectFile &Obj,
310310

311311
// We will use llvm-strip to remove the now unneeded section containing the
312312
// offloading code.
313-
ErrorOr<std::string> StripPath = sys::findProgramByName("llvm-strip");
313+
void *P = (void *)(intptr_t)&Help;
314+
StringRef COWDir = "";
315+
auto COWPath = sys::fs::getMainExecutable("llvm-strip", P);
316+
if (!COWPath.empty())
317+
COWDir = sys::path::parent_path(COWPath);
318+
ErrorOr<std::string> StripPath =
319+
sys::findProgramByName("llvm-strip", {COWDir});
314320
if (!StripPath)
315321
return createStringError(StripPath.getError(),
316322
"Unable to find 'llvm-strip' in path");

0 commit comments

Comments
 (0)