An Application Binary Interface (ABI) is the interface between two binary program modules that work together. An ABI is a contract between pieces of binary code defining the mechanisms by which functions are invoked and how parameters are passed between the caller and callee. ABIs have become critical in the development of applications leveraging smart contracts, on Blockchain protocols like Ethereum.
Understanding an Application Binary Interface
In understanding an Application Binary Interface, it can be helpful to first define the Application Programming Interface (API).
Think of an API as a contract between pieces of source code. This contract defines the return value and parameters of a function and dictates whether inheritance is allowed. An API is enforced by a compiler, or a program converting instructions into a format that can be read and executed by a computer. In other words, the API contains instructions on what the source code can and cannot do as part of a platform operating system.
An ABI, on the other hand, is a contract between pieces of binary code. An Application Binary Interface defines the mechanisms by which functions are invoked and how parameters are passed between the caller and callee. The ABI also governs how programs are loaded into memory and how libraries are implemented. Indeed, the ABI is enforced by the linker – defined as a program used with a compiler to provide links to libraries needed for an executable program.
This means the ABI contains rules on how unrelated code must work together and how processes should coexist on the same system. While the API lists the functions that may be called, the ABI dictates how each function may be called. ABIs are commonly established between user programs and libraries but also in OS services and programming languages.
Application Binary Interface functions
ABIs cover a variety of functions, including:
- Processor instruction sets that denote details such as memory access types and register file structure.
- How an application makes system calls to the OS and whether direct systems calls or procedure calls are used to system call stubs.
- Basic data type layout, size, and alignment.
Calling convention, which dictates how arguments of functions are passed and return values retrieved. Calling convention controls which parameters are passed on the stack and which are passed in registers. It also assigns registers to function parameters and determines whether the first function parameter passed on the stack is pushed first or last.
Complete and embedded ABIs
A complete ABI enables a program from the OS supporting it to run without modifications on any similar system. This is on the proviso that shared libraries exist and similar prerequisites are satisfied.
For example, the Intel Binary Compatibility Standard (iBCS) is the standardized ABI for Unix operating systems on Intel-compatible computers.
Embedded ABIs (EABIs) specify conventions for register usage, data types, stack frame organization, and file formats for use in an embedded operating system.
Object code created by compilers to support the EABI is compatible with the code generated by other compilers. This enables developers to link the library generated with one compiler with the library generated by another using object code.
Ultimately, embedded ABIs are designed for performance optimization. Operating within the limits of an embedded system, the ABI removes the majority of abstractions made between kernel and user code in complex operating systems.
PowerPC – created in an alliance between Apple, IBM, and Motorola – is an example of a widely used EABI.
An Application Binary Interface is the interface between two binary program module programs allowing them to work together.
While an Application Programming Interface (API) is a contract between two pieces of source code, an ABI is a contract between two sources of binary code. The ABI also dictates how functions may be called from the API.
Application Binary Interfaces are present in several scenarios. They influence processor instruction sets and determine how an application makes system calls to the OS. An ABI also dictates the layout, size, and alignment of basic data types.
Related Blockchain Business Frameworks
Main Free Guides: