Bug#724320: gmp: x32: sizeof(mp_limb_t)!=sizeof(void*) is not supported by GAP and PARI
Daniel Schepler
dschepler at gmail.com
Wed Oct 2 18:16:10 CEST 2013
On Wednesday, October 02, 2013 02:38:14 PM Vincent Lefevre wrote:
> On 2013-10-02 15:14:29 +0300, Marc Glisse wrote:
> > On Wed, 2 Oct 2013, Vincent Lefevre wrote:
> > >On 2013-10-02 11:52:54 +0200, Torbjorn Granlund wrote:
> > >>Vincent Lefevre <vincent at vinc17.net> writes:
> > >> 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.
> > >>
> > >>It sure does. ABI=...
> > >
> > >With which value??? ABI=x32 fails on x86_64: it passes -mx32 to gcc,
> > >which isn't supported.
> >
> > Yes it is, on gcc versions 4.7+ (the versions recent enough to
> > support the x32 ABI).
>
> It is by gcc itself, but not working on my machine: the generated
> executable segfaults. BTW, GMP's configure says "could not find a
> working compiler", which is misleading because the problem doesn't
> seem to be with the compiler itself.
>
> So, the problem remains: either support the override of the ABI
> in CFLAGS (but keeping the same type sizes implied by $ABI), or
> provide an alternative ABI value to force the mp_limb_t size to
> some value (e.g. by have mp_limb_t = long long, like with the
> mode32 ABI on PowerPC).
Is your kernel built with x32 support? (Check for CONFIG_X86_X32=y in
/boot/config-*.)
Anyway, to rephrase what others have already said, -m32 compiles to an i386
executable, which runs in compatibility mode from which x86_64 instructions
aren't available. Which explains why trying to force ABI=x32 with -m32
results in failing assembly; and if you disable assembly, it uses the gcc
version of 64-bit multiplication which simulates it using 3 or 4 32-bit
multiplications, which explains why it's so slow.
I agree with the comments on the original question: if GAP and PARI don't
support sizeof(mp_limb_t) > sizeof(long), then it makes most sense just to say
they're not supported on x32 at the moment.
--
Daniel Schepler
More information about the gmp-discuss
mailing list