ABI(5) ABI(5)
NAME
ABI - Application Binary Interface
TOPIC
This man page is intended to be a quick reference for the three ABI's
that are supported by IRIX. It is divided into 5 sections:
General Information and Overview
O32 Information
N64 Information
N32 Information
Summary Table
GENERAL INFORMATION AND OVERVIEW
An ABI defines a system interface for executing compiled programs. It
defines which instruction set architectures (ISA's) it supports as well
as object file formats and calling conventions.
IRIX supports three ABI's:
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 is introduced on IRIX 6.2.
Each of these ABI's 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's
platforms. See the NOTES section, below, for reference information.
Default ABI and ISA settings described in this man page can be overridden
in a number of ways: if it exists, the file /etc/compiler.defaults
contains the default settings on a given system; and the environment
variable, SGIABI may be used to specify default ABI values.
O32 Information
The O32 ABI supports the mips2 (by default) and mips1 ISA's. 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 up to four registers ($a0..$a3) to be used to pass integer
arguments. A full description of this ABI can be found in System V
Application Binary Interface -- MIPS Processor Supplement
Page 1
ABI(5) ABI(5)
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 will be compiled for the O32 ABI under the following
circumstances:
By default on systems that are not based on the R8000
(if the environment variable SGIABI is not set).
i.e. %cc foo.c
By using the -32 compilation flag (This overrides any SGIABI
setting).
i.e. %cc -32 foo.c
By using the -mips2 or -mips1 compilation flags.
i.e. %cc -mips2 foo.c
By setting the SGIABI environment variable to -32 and doing a
default compilation.
i.e. %setenv SGI_ABI -32
%cc foo.c
By setting the default ABI to -32 in the file /etc/compiler.defaults
i.e. %cat /etc/compiler.defaults
-DEFAULT:abi=o32
An O32 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:
MIPSFPSET = 16
MIPSISA = 2
ABIO32 = 1
MIPSSIM = _ABIO32
MIPSSZINT = 32
MIPSSZLONG = 32
MIPSSZPTR = 32
For more information about these predefined variables, please consult the
<sgidefs.h> include file.
N64 Information
The N64 ABI supports the mips4 (by default) and mips3 ISA's. 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 up to eight registers ($a0..$a7) to
be used to pass integer arguments. It also allows up to eight floating
Page 2
ABI(5) ABI(5)
point registers to be used to pass floating point arguments. A full
description of this calling convention can be found in 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 will be compiled for the N64 ABI under the following
circumstances:
By default on systems that are based on the R8000
(if the environment variable SGIABI is not set).
i.e. %cc foo.c
By using the -64 compilation flag (This overrides any SGIABI
setting).
i.e. %cc -64 foo.c
By using the -mips4 or -mips3 compilation flags.
i.e. %cc -mips4 foo.c
By setting the SGIABI environment variable to -64 and doing a
default compilation.
i.e. %setenv SGI_ABI -64
%cc foo.c
By setting the default ABI to -64 in the file /etc/compiler.defaults
i.e. %cat /etc/compiler.defaults
-DEFAULT:abi=64
An N64 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:
MIPSFPSET = 32
MIPSISA = 4
ABI64 = 3
MIPSSIM = _ABI64
MIPSSZINT = 32
MIPSSZLONG = 64
MIPSSZPTR = 64
Page 3
ABI(5) ABI(5)
N32 Information
The N32 ABI supports the mips3 (by default) and mips4 ISA's. 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 MIPSpro N32 ABI Guide
When an N32 program executes, IRIX sets the FR bit in the status register
of the MIPS microprocessor to 1, just like 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 will be compiled for the N32 ABI under the following
circumstances:
By using the -
n32 compilation flag (This overrides any SGIABI setting).
i.e. %cc -n32 foo.c
By setting the SGIABI environment variable to -n32 and doing a
default compilation.
i.e. %setenv SGI_ABI -n32
%cc foo.c
By setting the default ABI to -n32 in the file
/etc/compiler.defaults
i.e. %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:
MIPSFPSET = 32
MIPSISA = 4
ABI64 = 3
MIPSSIM = _NABI32
MIPSSZINT = 32
MIPSSZLONG = 32
MIPSSZPTR = 32
SUMMARY TABLE
The table below summarizes the characteristics of the three ABI's.
Page 4
ABI(5) ABI(5)
_____________________________________________________
| ABI Summary Table |
_____________________________________________________
| |
Category | O32 | N64 | N32
|____________________________________________________|
| | |
|Command Line Switch -32 -64 -n32 |
_____________________|_________|__________|__________
| |
Supported ISA's | mips1,2 | mips 3,4 | mips 3,4
|____________________________________________________|
| | |
|Default ISA mips2 mips4 mips3 |
_____________________|_________|__________|__________
| |
Object file format | ELF32 | ELF64 | ELF32
|____________________________________________________|
| | |
|Symbol table format .mdebug DWARF DWARF |
_____________________|_________|__________|__________
| |
Number of double | 16 | 32 | 32
| |
precision Floating | | |
| |
Point Registers | | |
|____________________________________________________|
| | |
|Calling Convention Old New New |
_____________________|_________|__________|__________
| |
sizeof(int) | 32 | 32 | 32
|____________________________________________________|
| | |
|sizeof(long) 32 64 32 |
_____________________|_________|__________|__________
| |
sizeof(char *) | 32 | 64 | 32
|____________________|_________|__________|__________|
SEE ALSO
Besides the other manpages mentioned below, System V Application Binary
Interface and System V Application Binary Interface -- are both good
sources of O32 ABI information. The MIPSpro N32 ABI Guide and the
MIPSpro 64-bit Porting and Transition Guide provide information about the
new calling convention as well as background on the new ABI's.
Please check the web page http://www.mipsabi.org/ for more information
about the MIPS ABI.
Page 5