Node:ABI and ISA, Next:, Previous:Build Options, Up:Installing GMP



ABI and ISA

ABI (Application Binary Interface) refers to the calling conventions between functions, meaning what registers are used and what sizes the various C data types are. ISA (Instruction Set Architecture) refers to the instructions and registers a CPU has available.

Some 64-bit ISA CPUs have both a 64-bit ABI and a 32-bit ABI defined, the latter for compatibility with older CPUs in the family. GMP supports some CPUs like this in both ABIs. In fact within GMP ABI means a combination of chip ABI, plus how GMP chooses to use it. For example in some 32-bit ABIs, GMP may support a limb as either a 32-bit long or a 64-bit long long.

By default GMP chooses the best ABI available for a given system, and this generally gives significantly greater speed. But an ABI can be chosen explicitly to make GMP compatible with other libraries, or particular application requirements. For example,

./configure ABI=32

In all cases it's vital that all object code used in a given program is compiled for the same ABI.

Usually a limb is implemented as a long. When a long long limb is used this is encoded in the generated gmp.h. This is convenient for applications, but it does mean that gmp.h will vary, and can't be just copied around. gmp.h remains compiler independent though, since all compilers for a particular ABI will be expected to use the same limb type.

Currently no attempt is made to follow whatever conventions a system has for installing library or header files built for a particular ABI. This will probably only matter when installing multiple builds of GMP, and it might be as simple as configuring with a special libdir, or it might require more than that. Note that builds for different ABIs need to done separately, with a fresh ./configure and make each.



HPPA 2.0 (hppa2.0*)
ABI=2.0w
The 2.0w ABI uses 64-bit limbs and pointers and is available on HP-UX 11 or up when using cc. gcc support for this is in progress. Applications must be compiled with
cc  +DD64

ABI=2.0n
The 2.0n ABI means the 32-bit HPPA 1.0 ABI but with a 64-bit limb using long long. This is available on HP-UX 10 or up when using cc. No gcc support is planned for this. Applications must be compiled with
cc  +DA2.0 +e

ABI=1.0
HPPA 2.0 CPUs can run all HPPA 1.0 and 1.1 code in the 32-bit HPPA 1.0 ABI. No special compiler options are needed for applications.

All three ABIs are available for CPUs hppa2.0w and hppa2.0, but for CPU hppa2.0n only 2.0n or 1.0 are allowed.


MIPS under IRIX 6 (mips*-*-irix[6789])
IRIX 6 supports the n32 and 64 ABIs and always has a 64-bit MIPS 3 or better CPU. In both these ABIs GMP uses a 64-bit limb. A new enough gcc is required (2.95 for instance).
ABI=n32
The n32 ABI is 32-bit pointers and integers, but with a 64-bit limb using a long long. Applications must be compiled with
gcc  -mabi=n32
cc   -n32

ABI=64
The 64-bit ABI is 64-bit pointers and integers. Applications must be compiled with
gcc  -mabi=64
cc   -64

Note that MIPS GNU/Linux, as of kernel version 2.2, doesn't have the necessary support for n32 or 64 and so only gets a 32-bit limb and the MIPS 2 code.


PowerPC 64 (powerpc64*)
ABI=aix64
The AIX 64 ABI uses 64-bit limbs and pointers and is available on systems powerpc64*-*-aix*. Applications must be compiled (and linked) with
gcc  -maix64
xlc  -q64

ABI=32L
This uses the 32-bit ABI but a 64-bit limb using GCC long long in 64-bit registers. Applications must be compiled with
gcc  -mpowerpc64

ABI=32
This is the basic 32-bit PowerPC ABI. No special compiler options are needed for applications.


Sparc V9 (sparcv9 and ultrasparc*)
ABI=64
The 64-bit V9 ABI is available on Solaris 2.7 and up and GNU/Linux. GCC 2.95 or up, or Sun cc is required. Applications must be compiled with
gcc  -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9
cc   -xarch=v9

ABI=32
On Solaris 2.6 and earlier, and on Solaris 2.7 with the kernel in 32-bit mode, only the plain V8 32-bit ABI can be used, since the kernel doesn't save all registers. GMP still uses as much of the V9 ISA as it can in these circumstances. No special compiler options are required for applications, though using something like the following requesting V9 code within the V8 ABI is recommended.
gcc  -mv8plus
cc   -xarch=v8plus

gcc 2.8 and earlier only supports -mv8 though.

Don't be confused by the names of these sparc -m and -x options, they're called arch but they effectively control the ABI.

On Solaris 2.7 with the kernel in 32-bit-mode, a normal native build will reject ABI=64 because the resulting executables won't run. ABI=64 can still be built if desired by making it look like a cross-compile, for example

./configure --build=none --host=sparcv9-sun-solaris2.7 ABI=64