gmp 4.3.1 failed cross compile for mingw-w64

zhou drangon drangon.zhou at gmail.com
Sat May 30 03:27:45 CEST 2009


2009/5/30 Torbjorn Granlund <tg at gmplib.org>:
> zhou drangon <drangon.zhou at gmail.com> writes:
>
>  $ /compile/mingw/cross/bin/x86_64-pc-mingw32-gcc -v
>  Using built-in specs.
>  Target: x86_64-pc-mingw32
>
> I don't know much about the target platform.
>
> Your subject line talks about mingw-w64, then you have set the target as
> mingw32.  Even of the names are not entirely symmetric, presumably they
> are intended to be, and refer to a 64-bit and 32-bit Windos ABI,
> respectively?

yes, I set the target as mingw32, but add one more line in configure file to
make it work under mingw-w64.

case $host in
  *-*-mingw*)
    gcc_cflags_optlist="$gcc_cflags_optlist nocygwin"
    gcc_cflags_nocygwin="-mno-cygwin"
+   limb_64=longlong
    ;;
esac

This simply is a trick, and with this modification, I can cross compile
gmp-4.2.4 and gmp-4.3.0 successfuly, and the library work well under
mingw-w64 platform.

>
> The 32-bit ABI is known to work, but I am not aware of any port of GMP
> to any 64-bit Windos ABI.
>

I think this is not the 64-bit Windows ABI problem. gmp-4.3.0 can be
compiled successfuly,
Changes from gmp-4.3.0 to gmp-4.3.1 is little, mostly in
mpn/sqr_basecase.asm file.
>From the error message, it seems it's the x86_64 assemble language problem.

 /compile/mingw/cross/bin/x86_64-pc-mingw32-gcc -c -DHAVE_CONFIG_H -I.
-I../../gmp-4.3.1/mpn -I.. -D__GMP_WITHIN_GMP -I../../gmp-4.3.1
-DOPERATION_sqr_basecase -g -pipe tmp-sqr_basecase.s -o sqr_basecase.o
tmp-sqr_basecase.s: Assembler messages:
tmp-sqr_basecase.s:124: Error: junk at end of line, first unrecognized
character is `,'

116     mov %edx, %r11d
117     mov %edx, %ecx
118     and $3, %ecx
119     lea 4(%rcx), %rbx
120     cmp $4, %edx
121     cmovg   %rbx, %rcx
122     lea Ljmptab(%rip), %rax
123     jmp *(%rax,%rcx,8)
124     .section    .data.rel.ro.local,"aw", at progbits
125     .align  8, 0x90
126 Ljmptab:
127     .quad   L4
128     .quad   L1
129     .quad   L2
130     .quad   L3

> If mingw-w64/mingw64 is to use the standard x86_64 calling conventions,
> then porting should not be terribly difficult.  Porting to Microsoft's
> 64-bit ABI will be much harder, since they changed anything they could
> change, compared to the x86_64 standard calling conventions.
>
> --
> Torbjörn
>



-- 
regards,

drangon
-------------------------
homepage : http://www.drangon.org/
mingw stuff : http://www.drangon.org/mingw/
-------------------------


More information about the gmp-bugs mailing list