forked from OSchip/llvm-project
[lli] Pass command line arguments in to the orc-lazy JIT.
This brings the LLI orc-lazy JIT's behavior more closely in-line with LLI's mcjit bahavior. llvm-svn: 285413
This commit is contained in:
parent
0241c961e1
commit
1a2e656c67
|
@ -104,8 +104,8 @@ static PtrTy fromTargetAddress(JITTargetAddress Addr) {
|
|||
return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
|
||||
}
|
||||
|
||||
int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
|
||||
char* ArgV[]) {
|
||||
int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
|
||||
const std::vector<std::string> &Args) {
|
||||
// Add the program's symbols into the JIT's search space.
|
||||
if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
|
||||
errs() << "Error loading program symbols.\n";
|
||||
|
@ -152,7 +152,10 @@ int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
|
|||
}
|
||||
|
||||
typedef int (*MainFnPtr)(int, char*[]);
|
||||
std::vector<const char *> ArgV;
|
||||
for (auto &Arg : Args)
|
||||
ArgV.push_back(Arg.c_str());
|
||||
auto Main = fromTargetAddress<MainFnPtr>(MainSym.getAddress());
|
||||
return Main(ArgC, ArgV);
|
||||
return Main(ArgV.size(), (char**)ArgV.data());
|
||||
}
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ private:
|
|||
std::vector<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
|
||||
};
|
||||
|
||||
int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
|
||||
char* ArgV[]);
|
||||
int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
|
||||
const std::vector<std::string> &Args);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
|
|
@ -403,7 +403,11 @@ int main(int argc, char **argv, char * const *envp) {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
return runOrcLazyJIT(std::move(Ms), argc, argv);
|
||||
std::vector<std::string> Args;
|
||||
Args.push_back(InputFile);
|
||||
for (auto &Arg : InputArgv)
|
||||
Args.push_back(Arg);
|
||||
return runOrcLazyJIT(std::move(Ms), Args);
|
||||
}
|
||||
|
||||
if (EnableCacheManager) {
|
||||
|
|
Loading…
Reference in New Issue