kkwli0 created this revision. kkwli0 added reviewers: jhuber6, jdoerfert. Herald added subscribers: guansong, yaxunl. kkwli0 requested review of this revision. Herald added subscribers: cfe-commits, sstefan1. Herald added a project: clang.
Add the search path for llvm-strip instead of solely relying on the PATH environment variable setting. Currently, `make check-openmp` has a few failures with the error: /build-llvm/./bin/clang-linker-wrapper: error: Unable to find 'llvm-strip' in path Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D118965 Files: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp =================================================================== --- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -303,7 +303,13 @@ // 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");
Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp =================================================================== --- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -303,7 +303,13 @@ // 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");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits