[llvm-commits] [llvm] r117095 - /llvm/trunk/tools/lli/lli.cpp

NAKAMURA Takumi geek4civic at gmail.com
Fri Oct 22 07:54:00 PDT 2010


Author: chapuni
Date: Fri Oct 22 09:53:59 2010
New Revision: 117095

URL: http://llvm.org/viewvc/llvm-project?rev=117095&view=rev
Log:
lli: On Cygwin-1.5, lli crashes at invoking destructors in atexit handler.

Modified:
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=117095&r1=117094&r2=117095&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Fri Oct 22 09:53:59 2010
@@ -33,6 +33,14 @@
 #include "llvm/System/Signals.h"
 #include "llvm/Target/TargetSelect.h"
 #include <cerrno>
+
+#ifdef __CYGWIN__
+#include <cygwin/version.h>
+#if defined(CYGWIN_VERSION_DLL_MAJOR) && CYGWIN_VERSION_DLL_MAJOR<1007
+#define DO_NOTHING_ATEXIT 1
+#endif
+#endif
+
 using namespace llvm;
 
 namespace {
@@ -99,8 +107,11 @@
 static ExecutionEngine *EE = 0;
 
 static void do_shutdown() {
+  // Cygwin-1.5 invokes DLL's dtors before atexit handler.
+#ifndef DO_NOTHING_ATEXIT
   delete EE;
   llvm_shutdown();
+#endif
 }
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list