diff --git a/llvm/unittests/Support/CrashRecoveryTest.cpp b/llvm/unittests/Support/CrashRecoveryTest.cpp --- a/llvm/unittests/Support/CrashRecoveryTest.cpp +++ b/llvm/unittests/Support/CrashRecoveryTest.cpp @@ -172,6 +172,13 @@ // Add LLVM_CRC_UNIXCRCRETURNCODE to the environment of the child process. std::vector EnvTable; EnvTable.push_back("LLVM_CRC_UNIXCRCRETURNCODE=1"); + std::string LibPathEnv; + // Preserve LD_LIBRARY_PATH environment variable + if (const char *LibPathValue = getenv("LD_LIBRARY_PATH")) { + LibPathEnv = "LD_LIBRARY_PATH="; + LibPathEnv += LibPathValue; + EnvTable.push_back(LibPathEnv); + } std::string Error; bool ExecutionFailed;