diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-27 17:02:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-27 17:02:33 +0000 |
commit | 020403209a86a3b4d210a4bc62b37ee5cf49dec8 (patch) | |
tree | 7e0d1ce72717557fa9ac706383820c0a7eff4cf1 /tools/lli | |
parent | b35417c607afc5d12f2facedf19afd0d68669f64 (diff) | |
download | llvm-020403209a86a3b4d210a4bc62b37ee5cf49dec8.tar.gz llvm-020403209a86a3b4d210a4bc62b37ee5cf49dec8.tar.bz2 llvm-020403209a86a3b4d210a4bc62b37ee5cf49dec8.tar.xz |
reset errno to zero on entry to the application's main function. This fixes
MultiSource/Applications/minisat in the JIT.
Note that the libsystem stuff should ideally never modify errno. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r-- | tools/lli/lli.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 225180b8ca..89e4be6b5f 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -28,7 +28,7 @@ #include "llvm/System/Process.h" #include "llvm/System/Signals.h" #include <iostream> - +#include <cerrno> using namespace llvm; namespace { @@ -128,6 +128,10 @@ int main(int argc, char **argv, char * const *envp) { // function later on to make an explicit call, so get the function now. Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy, Type::Int32Ty, NULL); + + // Reset errno to zero on entry to main. + errno = 0; + // Run static constructors. EE->runStaticConstructorsDestructors(false); |