summaryrefslogtreecommitdiffstats
path: root/llvm/tools/lli/lli.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-08 18:43:36 +0000
committerChris Lattner <sabre@nondot.org>2006-03-08 18:43:36 +0000
commitd0eb1d12d262dce12ba2abd71b9a49b82eb77e1d (patch)
tree1f41a5138cb87f88f8c5677d7d5f4f96a4afb258 /llvm/tools/lli/lli.cpp
parentfaae50b66bea90f4f5c0cbdb09378e7a66dcb2b5 (diff)
downloadbcm5719-llvm-d0eb1d12d262dce12ba2abd71b9a49b82eb77e1d.tar.gz
bcm5719-llvm-d0eb1d12d262dce12ba2abd71b9a49b82eb77e1d.zip
Fit to 80 columns.
Add support for running static ctor/dtors that aren't handled by __main. This fixes programs with the JIT and the new CFE, such as HBD. llvm-svn: 26620
Diffstat (limited to 'llvm/tools/lli/lli.cpp')
-rw-r--r--llvm/tools/lli/lli.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 73dfa11e5dd..6eec2647d2b 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -60,7 +60,8 @@ int main(int argc, char **argv, char * const *envp) {
try {
MP = getBytecodeModuleProvider(InputFile);
} catch (std::string &err) {
- std::cerr << "Error loading program '" << InputFile << "': " << err << "\n";
+ std::cerr << "Error loading program '" << InputFile << "': "
+ << err << "\n";
exit(1);
}
@@ -69,10 +70,10 @@ int main(int argc, char **argv, char * const *envp) {
MP->getModule()->setTargetTriple(TargetTriple);
ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter);
- assert(EE && "Couldn't create an ExecutionEngine, not even an interpreter?");
+ assert(EE &&"Couldn't create an ExecutionEngine, not even an interpreter?");
- // If the user specifically requested an argv[0] to pass into the program, do
- // it now.
+ // If the user specifically requested an argv[0] to pass into the program,
+ // do it now.
if (!FakeArgv0.empty()) {
InputFile = FakeArgv0;
} else {
@@ -96,11 +97,17 @@ int main(int argc, char **argv, char * const *envp) {
return -1;
}
- // Run main...
+ // Run static constructors.
+ EE->runStaticConstructorsDestructors(false);
+
+ // Run main.
int Result = EE->runFunctionAsMain(Fn, InputArgv, envp);
- // If the program didn't explicitly call exit, call exit now, for the program.
- // This ensures that any atexit handlers get called correctly.
+ // Run static destructors.
+ EE->runStaticConstructorsDestructors(true);
+
+ // If the program didn't explicitly call exit, call exit now, for the
+ // program. This ensures that any atexit handlers get called correctly.
Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
Type::IntTy,
(Type *)0);
OpenPOWER on IntegriCloud