Application binary interface

From Gentoo Wiki
(Redirected from ABI)
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

An application binary interface (ABI) is an interface exposed by software that is defined for in-process machine code access. It defines the low-level, machine-code-level binding between two or more binary modules, such as an application, a library, and an operating system[1].

An ABI is distinct from an application programming interface (API), which defines access at the source code level. While an API ensures source compatibility, allowing code to be recompiled against a new library version, a stable ABI ensures binary compatibility, allowing a compiled application to run with a new library version without being recompiled.

Aspects defined by an ABI

An ABI is specific to a hardware architecture and typically a programming language or platform. It is a comprehensive specification that covers the following aspects:

  • Data representation: The size, layout, and alignment of basic data types that the processor can directly access.
  • Calling convention: The methodology for how functions are invoked and how their arguments and return values are handled. This includes:
    • The use of CPU registers and the call stack for passing parameters.
    • The order in which parameters are passed.
    • The assignment of specific registers for particular function parameters.
    • The responsibility for cleaning up the call stack after a function call (either the caller or the callee).
  • System call interface: The mechanism and specific instruction numbers an application must use to make system calls to the operating system.
  • Name mangling: The scheme used by a compiler to encode function names and other symbols within object files, which is necessary to support language features like function overloading.
  • Exception propagation: The standardized method for handling and propagating exceptions between modules.
  • Object file format: The structure of the binary object files, program libraries, and executables, such as ELF on Unix-like systems or Portable Executable on Windows.

ABI examples

  • System V ABI: A standard ABI for Unix-like systems on various architectures, including amd64 (x86-64), various flavours of ARM, and PowerPC. It is the basis for the ABIs used by Linux, the BSDs, and macOS.[2][3]
  • Microsoft x64 ABI: The standard calling convention and ABI for 64-bit applications on the Windows operating system.[4]
  • ARM ABI: The standard ABI for applications executing on the ARM architecture.[5]
  • Itanium C++ ABI:[6] While the Itanium architecture was never common (and is now dead), its C++ ABI was widely adopted and now forms the basis for C++ name mangling and exception handling on most Unix-like platforms.

See also

References

  1. application binary interface - Wikiedia. Retrieved July 16, 2025.
  2. System V ABI - OSDev Wiki. Retrieved July 16, 2025.
  3. System V Application Binary Interface, AMD64 Architecture Processor Supplement. Retrieved July 16, 2025.
  4. x64 Calling Convention . Microsoft. Retrieved July 16, 2025.
  5. Application Binary Interface for the Arm® Architecture . GitHub. Retrieved July 16, 2025.
  6. Itanium C++ ABI. GitHub. Retrieved July 16, 2025.