GMP patch: MinGW/win64 port

Myria myriachan at
Sun Dec 9 10:29:48 CET 2007

> 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 

> 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.


More information about the gmp-bugs mailing list