aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authorSean Perry <perry@ca.ibm.com>2024-10-30 13:48:00 -0400
committerGitHub <noreply@github.com>2024-10-30 13:48:00 -0400
commit5545f76dc94e76ef6800823bdd1e107ad2264717 (patch)
treed94518b29f87770902e4a2d7b165264088860407 /clang/lib/Driver/ToolChain.cpp
parent705f3ebf1458c154fe63552ca984be6a16711661 (diff)
downloadllvm-5545f76dc94e76ef6800823bdd1e107ad2264717.zip
llvm-5545f76dc94e76ef6800823bdd1e107ad2264717.tar.gz
llvm-5545f76dc94e76ef6800823bdd1e107ad2264717.tar.bz2
Pass the executable name as arg[0] when calling ExecuteAndWait() (#114067)
PR https://github.com/llvm/llvm-project/pull/111976 was enabling the tests updated in the PR to run on all systems. We found a few didn't run on z/OS. I tracked the problem down to: 1. the ExecuteToolChainProgram() function wasn't passing the executable name as the first arg. That was causing exec on z/OS to fail. 2. the temp file needs to be a text file so codepage conversion happens.
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
-rw-r--r--clang/lib/Driver/ToolChain.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 34de004..bdf3da0 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -109,7 +109,8 @@ ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
ToolChain::executeToolChainProgram(StringRef Executable) const {
llvm::SmallString<64> OutputFile;
- llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile);
+ llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile,
+ llvm::sys::fs::OF_Text);
llvm::FileRemover OutputRemover(OutputFile.c_str());
std::optional<llvm::StringRef> Redirects[] = {
{""},
@@ -128,7 +129,8 @@ ToolChain::executeToolChainProgram(StringRef Executable) const {
*Str + "'");
SecondsToWait = std::max(SecondsToWait, 0); // infinite
}
- if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, SecondsToWait,
+ if (llvm::sys::ExecuteAndWait(Executable, {Executable}, {}, Redirects,
+ SecondsToWait,
/*MemoryLimit=*/0, &ErrorMessage))
return llvm::createStringError(std::error_code(),
Executable + ": " + ErrorMessage);