[llvm-commits] CVS: llvm/tools/lli/lli.cpp
Reid Spencer
reid at x10sys.com
Mon Mar 5 19:13:12 PST 2007
Changes in directory llvm/tools/lli:
lli.cpp updated: 1.68 -> 1.69
---
Log message:
Obtain the exit function before execution just in case the module
disappears before we get to calling the exit function.
---
Diffs of the changes: (+7 -5)
lli.cpp | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.68 llvm/tools/lli/lli.cpp:1.69
--- llvm/tools/lli/lli.cpp:1.68 Sat Mar 3 12:21:44 2007
+++ llvm/tools/lli/lli.cpp Mon Mar 5 21:12:55 2007
@@ -124,6 +124,10 @@
return -1;
}
+ // If the program doesn't explicitly call exit, we will need the Exit
+ // function later on to make an explicit call, so get the function now.
+ Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy,
+ Type::Int32Ty, NULL);
// Run static constructors.
EE->runStaticConstructorsDestructors(false);
@@ -133,14 +137,12 @@
// 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.
- Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy,
- Type::Int32Ty, NULL);
+ // If the program didn't call exit explicitly, we should call it now.
+ // This ensures that any atexit handlers get called correctly.
if (Function *ExitF = dyn_cast<Function>(Exit)) {
std::vector<GenericValue> Args;
GenericValue ResultGV;
- ResultGV.Int32Val = Result;
+ ResultGV.IntVal = APInt(32, Result);
Args.push_back(ResultGV);
EE->runFunction(ExitF, Args);
std::cerr << "ERROR: exit(" << Result << ") returned!\n";
More information about the llvm-commits
mailing list