Bug#724320: gmp: x32: sizeof(mp_limb_t)!=sizeof(void*) is not supported by GAP and PARI

Vincent Lefevre vincent at vinc17.net
Wed Oct 2 11:38:26 CEST 2013


On 2013-10-02 11:02:26 +0200, Torbjorn Granlund wrote:
> Vincent Lefevre <vincent at vinc17.net> writes:
> 
>   I've tried
>   
>     ./configure ABI=x32 CFLAGS='-O2 -pedantic -fomit-frame-pointer -m32'
>   
>   with GMP 5.1.2, but the build fails. Adding --disable-assembly solves
>   the problem, but it makes GMP very slow!
> 
> Could you provide more details than "the build fails"?  :-)

I've retried with GMP 5.1.3, and get:

[...]
/home/vlefevre/dash/bin/dash ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo add_n | sed 's/_$//'`    -O2 -pedantic -fomit-frame-pointer -m32 -Wa,--noexecstack `test -f 'add_n.asm' || echo './'`add_n.asm
libtool: compile:  ../mpn/m4-ccas --m4=m4 gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_add_n -O2 -pedantic -fomit-frame-pointer -m32 -Wa,--noexecstack add_n.asm  -fPIC -DPIC -o .libs/add_n.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_add_n -DPIC add_n.asm >tmp-add_n.s
 gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_add_n -O2 -pedantic -fomit-frame-pointer -m32 -Wa,--noexecstack tmp-add_n.s -fPIC -DPIC -o .libs/add_n.o
tmp-add_n.s: Assembler messages:
tmp-add_n.s:91: Error: bad register name `%r8'
tmp-add_n.s:93: Error: bad register name `%rsi)'
tmp-add_n.s:94: Error: bad register name `%rdx)'
tmp-add_n.s:96: Error: bad register name `%rsi'
tmp-add_n.s:97: Error: bad register name `%rdx'
tmp-add_n.s:98: Error: bad register name `%rdi'
tmp-add_n.s:100: Error: bad register name `%rcx'
tmp-add_n.s:103: Error: bad register name `%rax'
tmp-add_n.s:108: Error: bad register name `%r8'
tmp-add_n.s:111: Error: bad register name `%r8'
tmp-add_n.s:112: Error: bad register name `%r10'
tmp-add_n.s:113: Error: bad register name `%r11'
tmp-add_n.s:114: Error: bad register name `%rcx)'
tmp-add_n.s:117: Error: bad register name `%r8'
tmp-add_n.s:120: Error: bad register name `%r8'
tmp-add_n.s:121: Error: bad register name `%r10'
tmp-add_n.s:122: Error: bad register name `%r11'
tmp-add_n.s:125: Error: bad register name `%r11'
tmp-add_n.s:126: Error: bad register name `%r10'
tmp-add_n.s:134: Error: bad register name `%rsi'
tmp-add_n.s:135: Error: bad register name `%rdx'
tmp-add_n.s:136: Error: bad register name `%r11'
tmp-add_n.s:137: Error: bad register name `%r10'
tmp-add_n.s:139: Error: bad register name `%rsi'
tmp-add_n.s:140: Error: bad register name `%rdx'
tmp-add_n.s:141: Error: bad register name `%r9'
tmp-add_n.s:142: Error: bad register name `%r8'
tmp-add_n.s:144: Error: bad register name `%rsi'
tmp-add_n.s:145: Error: bad register name `%rdx'
tmp-add_n.s:146: Error: bad register name `%r11'
tmp-add_n.s:147: Error: bad register name `%r10'
tmp-add_n.s:149: Error: bad register name `%rsi'
tmp-add_n.s:150: Error: bad register name `%rdx'
tmp-add_n.s:151: Error: bad register name `%r9'
tmp-add_n.s:152: Error: bad register name `%r8'
tmp-add_n.s:154: Error: `jrcxz' is only supported in 64-bit mode
tmp-add_n.s:155: Error: bad register name `%rcx)'
make[2]: *** [add_n.lo] Error 1
make[2]: Leaving directory `/home/vlefevre/software/gmp-5.1.3/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/vlefevre/software/gmp-5.1.3'
make: *** [all] Error 2

where mpn/add_n.asm -> ../mpn/x86_64/core2/aors_n.asm

It seems that GMP doesn't look at what is provided in CFLAGS.

> We have x32 in our nightly builds, in a Gentoo x32 chroot.  You cannot
> expect x32 to work without kernel and libc support.

Actually that's the usual 32-bit ABI, where GMP thinks it is x32.
This should not be a problem (except with asm code, see above)
because from the API point of view, 32-bit and x32 and similar:
the size of the native C types are the same.

It would be cleaner to have an option to force the mp_limb_t size
e.g. to 8 bytes, but GMP doesn't seem to provide such an option.

> PS. Your Mail-Followup-To is strange, it made the reply to primarily
> to Bill.

It was correct (I've just masked the domain part), given that Bill
didn't have a Mail-Followup-To:

Mail-Followup-To: Bill Allombert <Bill.Allombert at x>,
        Max Horn <max at x>, gmp-discuss at x,
        Daniel Schepler <dschepler at x>

Unless it was rewritten by the mailing-list software (which would
be wrong), the reply shouldn't have gone to Bill only.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list