[MLton] Problem with MinGW

Stephen Weeks MLton@mlton.org
Thu, 8 Jun 2006 14:21:38 -0700


> I thought the "reserveEsp" hack for Cygwin was for signal handling,
> since Cygwin doesn't provide sigaltstack.

Me too.  Although I was confused by the contradiction between code
defining reserveEsp and its accompanying comment.

         val reserveEsp =
            (* There is no sigaltstack on cygwin, we need to reserve %esp to
             * hold the C stack pointer.  We need to do this even in programs
             * that don't handle signals, since signals get used under the hood
             * in Cygwin.
             *)
            handlesSignals andalso let open Control in !targetOS = Cygwin end

Given the comment, I would have expected an "orelse" instead of an
"andalso".  Your recollection jibes with the code.

In any case, this problem sounds eerily like the thread titled

  "Cygwin, file open, and reserveEsp"

mentioned in December '03

  http://mlton.org/pipermail/mlton/2003-December/thread.html

> But, it's another good guess where the native and C codegens differ.

Yeah, some weirdness about the MinGW C calling convention/invariants
feels like the right place.