SGI Techpubs Library

IRIX 6.5  »  Man Pages
find in page

ABI(5)

 NAME

     ABI - Application Binary Interface

 DESCRIPTION

     This man page is a quick reference for the three Application Binary
     Interfaces (ABI) that are supported by IRIX.

 GENERAL INFORMATION

     An ABI defines a system interface for executing compiled programs.  It
     defines which Instruction Set Architectures (ISA) it supports as well
     as defining object file formats and calling conventions.

     IRIX supports three ABIs:

     o32  The old 32-bit ABI which was standard on IRIX 5 systems.

     n64  The 64-bit ABI which was introduced on IRIX 6.0 systems.

     n32  The new high performance 32-bit ABI which was introduced on IRIX
          6.2.

     Each of these ABIs defines unique interfaces which make it impossible
     to link object files of one ABI with object files of another ABI.

     The MIPS ABI is a subset of the above mentioned o32 ABI and is
     designed to provide application portability across a variety of vendor
     platforms.

     Default ABI and ISA settings described in this man page can be
     overridden by changing the default settings for a given system,
     contained in the /etc/compiler.defaults file; or by changing the
     SGI_ABI environment variable, which can be used to specify default ABI
     values.

 o32 Information

     The o32 ABI supports the mips2 ISA (by default) and mips1 ISA.  The
     resulting program binary is in ELF32 format (COFF is no longer
     supported) whose symbol table is in .mdebug format.  The o32 calling
     convention allows a maximum of four registers ($a0..$a3) to be used to
     pass integer arguments.

     When an o32 program executes, IRIX sets the FR bit in the status
     register of the MIPS microprocessor to 0. Under this setting, only 16
     double precision floating point registers are enabled.

     C language integer types (int), long integer types (long), and pointer
     types (char *) are all 32-bits wide in programs compiled for this ABI.

     A program is compiled for the o32 ABI under the following
     circumstances:

     * By default on systems that are not based on the R8000 (if the
       environment variable SGI_ABI is not set), as in this example:

          cc foo.c

     * By using the -32 compilation flag; this overrides any SGI_ABI
       setting, as in this example:

          cc -32 foo.c

     * By using the -mips2 or -mips1 compilation flags, as in this example:

          cc -mips2 foo.c

     * By setting the SGI_ABI environment variable to -32 and doing a
       default compilation, as in this example:

          setenv SGI_ABI -32
          cc foo.c

     * By setting the default ABI to -32 in the /etc/compiler.defaults
       file, as in this example:

          cat /etc/compiler.defaults
          -DEFAULT:abi=o32

     An o32 compilation generates certain predefined variables whose values
     can be used by conditional compilation directives.  The names of these
     variables and their values are as follows:

          _MIPS_FPSET  = 16
          _MIPS_ISA    = 2
          _ABIO32      = 1
          _MIPS_SIM    = _ABIO32
          _MIPS_SZINT  = 32
          _MIPS_SZLONG = 32
          _MIPS_SZPTR  = 32

     For more information about these predefined variables, see the
     <sgidefs.h> include file.

 n64 Information

     The n64 ABI supports the mips4 ISA (by default) and mips3 ISA.  The
     resulting program binary is in ELF64 format whose symbol table is in
     DWARF format.  The n64 calling convention is different from the o32
     calling convention in that it allows a maximum of eight registers
     ($a0..$a7) to be used to pass integer arguments. It also allows a
     maximum of eight floating point registers to be used to pass floating
     point arguments. A full description of this calling convention can be
     found in the MIPSpro 64-Bit Porting and Transition Guide.

     When an n64 program executes, IRIX sets the FR bit in the status
     register of the MIPS microprocessor to 1. Under this setting, all 32
     double precision floating point registers are enabled. This improves
     performance, but old assembly code that accesses a double precision
     floating point register as a pair (one even and one odd) of single
     precision floating point registers will not work.

     C language integer types (int) are 32 bits wide, while long integer
     types (long), and pointer types (char *) are both 64-bits wide in
     programs compiled for this ABI.

     A program is compiled for the n64 ABI under the following
     circumstances:

     * By default on systems that are based on the R8000 (if the
       environment variable SGI_ABI is not set), as in this example:

          cc foo.c

     * By using the -64 compilation flag; this overrides any SGI_ABI
       setting, as in this example:

          cc -64 foo.c

     * By using the -mips4 or -mips3 compilation flags, as in this example:

          cc -mips4 foo.c

     * By setting the SGI_ABI environment variable to -64 and doing a
       default compilation, as in this example:

          setenv SGI_ABI -64
          cc foo.c

     * By setting the default ABI to -64 in the /etc/compiler.defaults
       file, as in this example:

          cat /etc/compiler.defaults
          -DEFAULT:abi=64

     An n64 compilation generates certain predefined variables whose values
     can be used by conditional compilation directives.  The names of these
     variables and their values are as follows:

          _MIPS_FPSET  = 32
          _MIPS_ISA    = 4
          _ABI64       = 3
          _MIPS_SIM    = _ABI64
          _MIPS_SZINT  = 32
          _MIPS_SZLONG = 64
          _MIPS_SZPTR  = 64

 n32 Information

     The n32 ABI supports the mips3 (by default) and mips4 ISA.  The
     resulting program binary is in ELF32 format whose symbol table is in
     DWARF format.  The n32 calling convention is the same as the n64
     calling convention.  A full description of this calling convention can
     be found in the MIPSpro N32 ABI Handbook.

     When an n32 program executes, IRIX sets the FR bit in the status
     register of the MIPS microprocessor to 1, just as it does for an n64
     program.  Under this setting, all 32 double precision floating point
     registers are enabled.  This has the same performance and
     compatibility implications as with n64.

     C language integer types (int), long integer types (long), and pointer
     types (char *) are all 32-bits wide in programs compiled for this ABI.

     A program is compiled for the n32 ABI under the following
     circumstances:

     * By using the -n32 compilation flag; this overrides any SGI_ABI
       setting, as in this example:

          cc -n32 foo.c

     * By setting the SGI_ABI environment variable to -n32 and doing a
       default compilation, as in this example:

          setenv SGI_ABI -n32
          cc foo.c

     * By setting the default ABI to -n32 in the /etc/compiler.defaults
       file.

          cat /etc/compiler.defaults
          -DEFAULT:abi=n32

     An N32 compilation will generate certain predefined variables whose
     values can be used by conditional compilation directives.  The names
     of these variables and their values are as follows:

          _MIPS_FPSET  = 32
          _MIPS_ISA    = 3
          _ABI64       = 3
          _MIPS_SIM    = _NABI32
          _MIPS_SZINT  = 32
          _MIPS_SZLONG = 32
          _MIPS_SZPTR  = 32
          _ABIN32      = 2
          _MIPS_SIM    = _ABIN32

   Summary Table
     The table below summarizes the characteristics of the three ABI's.

     -----------------------------------------------------------------
     Category                 O32           n64           n32
     -----------------------------------------------------------------
     Command Line Switch      -32           -64           -n32
     Supported ISA            mips1,2       mips 3,4      mips 3,4
     Default ISA              mips2         mips4         mips3
     Object file format       ELF32         ELF64         ELF32
     Debug info format        mdebug        DWARF         DWARF
     Symbol table format      ELF32         ELF64         ELF32
     Number of double         16            32            32
     precision floating
     point registers
     bits in int              32            32            32
     bits in long             32            64            32
     bits in char *           32            64            32
     -----------------------------------------------------------------

 SEE ALSO

     The MIPSpro N32 ABI Handbook and the MIPSpro 64-Bit Porting and
     Transition Guide provide information about the calling convention as
     well as background on these ABIs.

     mips_ext(5)




home/search | what's new | help