ABI defaults

Niels Möller nisse at lysator.liu.se
Mon Nov 22 12:05:53 CET 2010

Torbjorn Granlund <tg at gmplib.org> writes:

> This is a start.  The tricky part is figuring out how to put this into
> configure.in (i.e., where to insert or invoke this code).
> The current autoconf type size determination code cannot be run before
> we have chosen a compiler.  Your code must be run after the type size
> determination code.  But when we choose ABI with the current methods
> (i.e., use "best" ABI) or from a user selected ABI=foo argument, we
> don't want to determine the type sizes for the default compiler without
> any abi-changing arguments.

> It is not clear how to address this.

I suspect we need two quite separate cases in configure.in, doing things
in different order. For the ABI=default case, things should be fairly

  * Do a standard AC_PROG_CC,

  * do AC_CHECK_SIZEOF on various types,

  * run the script to figure out the ABI,

  * then go on to the part of the configure script which selects the
    assembly path.

Right? What else is thare which depends on the ABI? At least for a
start, I don't think we need to do anything clever with CFLAGS, except
maybe apend some extra optimization flags for some known compilers.

BTW, do you have a list of which platforms have more choices of ABI than
simply 32-bit or 64-bit? A quick look in configure.in turns up:

HPPA: 1.0, 2.0n, 2.0w,

MIPS64: n32, o32, 64

PPC64: Unclear, I see 32, mode32, mode64, aix64, but I'm not sure which
       can coexist on the same platform.

> (It has been suggested that we should change GMP's greedy ABI selection,
> and instead use whatever ABI to which any found compiler defaults.  I
> don't think that's a great idea, since it would hurt performance on
> many, many systems.)

The counter argument is that in order to benefit from that increased
performance, the applications have to be compiled with the "best" ABI as
well. And if you have to pass CFLAGS=-m64 (or CC="gcc -m64") to the
configure scripts of all gmp applications (and all other libraries they
depend on), it shouldn't be a big problem if you have to pass the same
flags explicitly also to gmp's configure script.

(If one really wants the best performance for all applications, maybe
one could do the following hack: a 32-bit gmp wrapper library, which at
startup forks a 64-bit helper-process linked to the real 64-bit gmp
library, shares a block of memory, and communicates with it for all gmp


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list