ABI defaults

Torbjorn Granlund tg at gmplib.org
Wed Nov 17 14:14:48 CET 2010

nisse at lysator.liu.se (Niels Möller) writes:

  By default, gmp's configure selects what it considers to be the best
  available ABI, and it can be overridden manually with ABI=32 or ABI=64.

Or whatever the names are for the ABI on the host.  Some RISC machines
that started out as 32-bit only, have 3 ABIs, two ILP32, and one LP64.
The two ILP32 are the original 32-bit ABI and a newer ABI which allow
for beter support for 64-bit arithmetic.  (MIPS, HP-PA are example.)

  Can I pass any flag to configure to tell it that I want whatever ABI is
  the compiler's default, so that after make install,

    gcc foo.c -lgmp

  will just work (assuming the same gcc was used for compiling gmp)?

No, I don't think that is currently possible.  But this would be a nice
extension of the configure system.

It is not clear how to deterimine it, though.  Clearly, we have to run
the compiler, and then check properties of it.

Checking the width of types is standard autoconf stuff, and it gives
some information.  Compiling to object code and running a 'file foo.o'
type command might give some more information.

I'd try writing this as a separate script, designed to be invoked from
'configure' and expecting parameters for plain type sizes.  These sizes
are most easily figured out by configure:

figure-out-default-abi.sh [compiler-with-flags] [longlongsize] [longsize] [intsize]

The script should print to stdout a standard GMP ABI name, or something
like "unknown".

To invoke this functionality, one may use ABI=default (in which case we
might need to rename the ABIs that we actually call 'default', such as
on alpha) or perhaps --enable-abi-detection.

(We might actually run the script always, to check consistency between
any given CC argument and any given ABI argument.  That would allow us
to give less mysterous error messages.)


More information about the gmp-devel mailing list