diff options
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); |