[MLton] Re: GMP patch: MinGW/win64 port

Myria myriachan at cox.net
Sat Mar 1 05:44:27 PST 2008


> With the small attached patch, GMP compiles on MinGW/win64 using the
> latest cross compiler. The patch fixes the assumption that 'long = 64
> bits' on all intel 64 bit platforms. Under win64, long remains 32 bit
> < pointer size. Also, the ABI for windows differs from linux, so the
> patch disables linux-specific assembly, using the generic C instead.

Brian Gladman made a Win64 assembly port of GMP, but it was made for MASM 
and Visual Studio 8.  At the time, MASM was the only assembler capable of 
emitting Win64's mandatory function markup.  Did binutils ever get this 
feature?

> It is necessary to use 'malloc-reentrant' to forbid use of alloca,
> which appears to be broken under win64.

Win64 GCC bug?  I could see why that might be true, because the Win64 
function markup system special-cases alloca (__chkstk).

> t-printf fails because the win64 printf ignores the high 32 bits of
> %llu.

MinGW's fault for using msvcrt.dll instead of its own C library.  This is 
the Windows equivalent of making a Linux compiler that links against libc1. 
The modern version, msvcr80.dll, understands %llu.

-Melissa 



More information about the MLton mailing list