mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
Added -rsh-host and -rsh-user to support remote execution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36685 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
82493289e0
commit
34e400ebe6
@ -15,6 +15,7 @@
|
|||||||
#include "ToolRunner.h"
|
#include "ToolRunner.h"
|
||||||
#include "llvm/Config/config.h" // for HAVE_LINK_R
|
#include "llvm/Config/config.h" // for HAVE_LINK_R
|
||||||
#include "llvm/System/Program.h"
|
#include "llvm/System/Program.h"
|
||||||
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -22,6 +23,16 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
cl::opt<std::string>
|
||||||
|
RSHHost("rsh-host",
|
||||||
|
cl::desc("Remote execution (rsh) host"));
|
||||||
|
|
||||||
|
cl::opt<std::string>
|
||||||
|
RSHUser("rsh-user",
|
||||||
|
cl::desc("Remote execution (rsh) user id"));
|
||||||
|
}
|
||||||
|
|
||||||
ToolExecutionError::~ToolExecutionError() throw() { }
|
ToolExecutionError::~ToolExecutionError() throw() { }
|
||||||
|
|
||||||
/// RunProgramWithTimeout - This function provides an alternate interface to the
|
/// RunProgramWithTimeout - This function provides an alternate interface to the
|
||||||
@ -482,7 +493,22 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
|
|
||||||
std::vector<const char*> ProgramArgs;
|
std::vector<const char*> ProgramArgs;
|
||||||
|
|
||||||
|
if (RSHPath.isEmpty())
|
||||||
ProgramArgs.push_back(OutputBinary.c_str());
|
ProgramArgs.push_back(OutputBinary.c_str());
|
||||||
|
else {
|
||||||
|
ProgramArgs.push_back(RSHPath.c_str());
|
||||||
|
ProgramArgs.push_back(RSHHost.c_str());
|
||||||
|
ProgramArgs.push_back("-l");
|
||||||
|
ProgramArgs.push_back(RSHUser.c_str());
|
||||||
|
|
||||||
|
char* env_pwd = getenv("PWD");
|
||||||
|
std::string Exec = "cd ";
|
||||||
|
Exec += env_pwd;
|
||||||
|
Exec += "; ./";
|
||||||
|
Exec += OutputBinary.c_str();
|
||||||
|
ProgramArgs.push_back(Exec.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// Add optional parameters to the running program from Argv
|
// Add optional parameters to the running program from Argv
|
||||||
for (unsigned i=0, e = Args.size(); i != e; ++i)
|
for (unsigned i=0, e = Args.size(); i != e; ++i)
|
||||||
ProgramArgs.push_back(Args[i].c_str());
|
ProgramArgs.push_back(Args[i].c_str());
|
||||||
@ -497,9 +523,15 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
);
|
);
|
||||||
|
|
||||||
FileRemover OutputBinaryRemover(OutputBinary);
|
FileRemover OutputBinaryRemover(OutputBinary);
|
||||||
|
|
||||||
|
if (RSHPath.isEmpty())
|
||||||
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
|
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
|
||||||
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||||
Timeout, MemoryLimit);
|
Timeout, MemoryLimit);
|
||||||
|
else
|
||||||
|
return RunProgramWithTimeout(sys::Path(RSHPath), &ProgramArgs[0],
|
||||||
|
sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
|
||||||
|
Timeout, MemoryLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
||||||
@ -583,6 +615,10 @@ GCC *GCC::create(const std::string &ProgramPath, std::string &Message) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sys::Path RSHPath;
|
||||||
|
if (!RSHHost.empty())
|
||||||
|
RSHPath = FindExecutable("rsh", ProgramPath);
|
||||||
|
|
||||||
Message = "Found gcc: " + GCCPath.toString() + "\n";
|
Message = "Found gcc: " + GCCPath.toString() + "\n";
|
||||||
return new GCC(GCCPath);
|
return new GCC(GCCPath, RSHPath);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,9 @@ public:
|
|||||||
//
|
//
|
||||||
class GCC {
|
class GCC {
|
||||||
sys::Path GCCPath; // The path to the gcc executable
|
sys::Path GCCPath; // The path to the gcc executable
|
||||||
GCC(const sys::Path &gccPath) : GCCPath(gccPath) { }
|
sys::Path RSHPath; // The path to the rsh executable
|
||||||
|
GCC(const sys::Path &gccPath, const sys::Path &rshPath)
|
||||||
|
: GCCPath(gccPath), RSHPath(rshPath) { }
|
||||||
public:
|
public:
|
||||||
enum FileType { AsmFile, CFile };
|
enum FileType { AsmFile, CFile };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user