Anonymous user
System V ABI: Difference between revisions
m
Updated document link
[unchecked revision] | [unchecked revision] |
Glauxosdever (talk | contribs) (Add information about -fomit-frame-pointer) |
m (Updated document link) |
||
(11 intermediate revisions by 4 users not shown) | |||
Line 1:
The '''System V Application Binary Interface''' is a set of specifications that detail [[Calling Conventions|calling conventions]], [[Object Files|object file formats]], [[Executable Formats|executable file formats]], dynamic linking semantics, and much more for systems that complies with the ''X/Open Common Application Environment Specification'' and the ''System V Interface Definition''. It is today the standard ABI used by the major Unix operating systems such as Linux, the BSD systems, and many others. The [[Executable and Linkable Format]]
The ABI is organized as a portable base document and platform-specific supplements that fill in the blank gaps. Unofficial new architecture processor supplements have been published as the format has been adapted to new platforms such as [[X86-64]]. The standard is extensible and the format continues to evolve as Unix vendors add new features. Due to the many unofficial supplement specifications and the chaotic history of the Unix operating systems, the current situation is that the System V ABI has become a family of unofficial draft specifications with no real central governing body.
Many of the advanced feature such as dynamic linking are optional and loading a simple statically linked [[ELF]] program is straightforward. Earlier versions of the standard were more ambitious and attempted to standardize software package installation formats and X11 details, while these obsolete details are disregarded today. The ABI is well-understood by common operating system
== Executable and Linkable Format ==
Line 16:
=== i386 ===
This is a 32-bit platform. The stack grows downwards. Parameters to functions are passed on the stack in reverse order such that the first parameter is the last value pushed to the stack, which will then be the lowest value on the stack. Parameters passed on the stack may be modified by the called function. Functions are called using the <tt>call</tt> instruction that pushes the address of the next instruction to the stack and jumps to the operand. Functions return to the caller using the <tt>ret</tt> instruction that pops a value from the stack and jump to it. The stack is 4-byte aligned all the time, on older systems and those honouring the SYSV psABI. On some newer systems, the stack is additionally 16-byte aligned just before the call instruction is called (usually those that want to support SSE instructions); consult your manual (GNU/Linux on i386 has recently become such a system, but code mixing with 4-byte stack alignment-assuming code is possible).
Functions preserve the registers <tt>ebx</tt>, <tt>esi</tt>, <tt>edi</tt>, <tt>ebp</tt>, and <tt>esp</tt>; while <tt>eax</tt>, <tt>ecx</tt>, <tt>edx</tt> are scratch registers. The return value is stored in the <tt>eax</tt> register, or if it is a 64-bit value, then the higher 32-bits go in <tt>edx</tt>. Functions push <tt>ebp</tt> such that the <tt>caller-return-eip</tt> is 4 bytes above it, and set <tt>ebp</tt> to the address of the saved ebp. This allows iterating through the existing stack frames. This can be eliminated by specifying the <tt>-fomit-frame-pointer</tt> GCC option.
=== x86-64 ===
Line 33:
=== Documents ===
'''TODO:''' ''Ensure whether these are the latest official links. These documents are simply what I
* base document and addons
** [http://www.sco.com/developers/
** [http://www.sco.com/developers/devspecs/
** [http://www.
* x86 (i8086, i386, amd64, x32, k1om)
* [http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf System V ABI - MIPS RISC Processor Supplement]▼
** [
** [http://
** [http://
* MIPS
* [http://math-atlas.sourceforge.net/devel/assembly/PPC-elf64abi-1.7.pdf System V ABI - 64-bit PowerPC]▼
** [http://math-atlas.sourceforge.net/devel/assembly/
** [http://math-atlas.sourceforge.net/devel/assembly/
** [http://
* PowerPC
* [http://www.csee.umbc.edu/portal/help/architecture/24537001.pdf System V ABI - IA-64 Architecture Processor Supplement]▼
▲** [http://math-atlas.sourceforge.net/devel/assembly/
▲** [http://math-atlas.sourceforge.net/devel/assembly/PPC-elf64abi-1.7.pdf System V ABI - 64-bit PowerPC]
* SPARC
** [http://math-atlas.sourceforge.net/devel/assembly/abi_sysV_sparc.pdf System V ABI - SPARC® Processor Supplement]
** [http://math-atlas.sourceforge.net/devel/assembly/64.psabi.1.33.ps.Z System V ABI - SPARC® Version 9 Processor Supplement]
* Itanium
▲** [http://www.csee.umbc.edu/portal/help/architecture/24537001.pdf System V ABI - IA-64 Architecture Processor Supplement]
* ⚠ not SYSV ABI, but at least the architecture-official calling standards:
** [http://bitsavers.trailing-edge.com/pdf/dec/alpha/Alpha_Calling_Standard_Rev_2.0_19900427.pdf DEC Alpha calling standard]
===External Links===
* [http://www.sco.com/developers/gabi/ System V ABI Website]
* [https://refspecs.linuxfoundation.org/ Linux Foundation — Referenced Specifications]
* [https://course.ece.cmu.edu/~ece447/s15/doku.php?id=techdocs Introduction to Computer Architecture — Technical Documents]
[[Category:ABI]]
|