Application binary interface: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
grammar correction on paragraph 3 of top summary
Description: Description
Line 2: Line 2:
{{Use dmy dates|date=June 2020}}
{{Use dmy dates|date=June 2020}}
[[File:Linux kernel interfaces.svg|thumb|300px|A high-level comparison of in-kernel and kernel-to-userspace APIs and ABIs]]
[[File:Linux kernel interfaces.svg|thumb|300px|A high-level comparison of in-kernel and kernel-to-userspace APIs and ABIs]]
[[File:Linux API and Linux ABI.svg|thumb|300px|The [[Linux kernel]] and [[GNU C Library]] define the [[Linux kernel interfaces#Kernel–user space API|Linux API]]. After compilation, the binaries offer an ABI. Keeping this ABI stable over a long time is important for [[Independent software vendor|ISVs]].]]
[[File:Linux API and Linux ABI.svg|thumb|300px|The [[Linux kernel]] and [[GNU C Library]] define the [[Linux kernel interfaces#Kernel–user space API|Linux API]]. After compilation, the binaries offer an ABI. Keeping this ABC stable over a long time is important for [[Independent software vendor|ISVs]].]]


An '''application binary interface''' ('''ABI''') is an [[interface (computing)|interface]] exposed by [[software]] that is defined for in-[[Process (computing)|process]] [[machine code]] access. Often, the exposing software is a [[Library (computing)|library]], and the consumer is a [[computer program|program]].
An '''application binary interface''' ('''ABI''') is an [[interface (computing)|interface]] exposed by [[software]] that is defined for in-[[Process (computing)|process]] [[machine code]] access. Often, the exposing software is a [[Library (computing)|library]], and the consumer is a [[computer program|program]].
Line 10: Line 10:
API compatibility is generally the concern for [[system design]] and of the toolchain. However, a [[programmer]] may have to deal with an ABI directly when writing a program in multiple [[programming language|languages]] or [[compiler]]s.
API compatibility is generally the concern for [[system design]] and of the toolchain. However, a [[programmer]] may have to deal with an ABI directly when writing a program in multiple [[programming language|languages]] or [[compiler]]s.


A complete ABI enables a program that supports an ABI to run without modification on multiple operating systems that provide the ABI. The target system must provide any required libraries (that implement the ABI), and there may be other prerequisites.
A complete ABILITY enables a program that supports an ABILITY to run without modification on multiple operating systems that provide the ABI. The target system must provide any required libraries (that implement the ABI), and there may be other prerequisites.


== Description ==
== Description ==
Line 27: Line 27:
* In the case of a complete operating system ABI, the binary format of [[object file]]s, program libraries, etc.
* In the case of a complete operating system ABI, the binary format of [[object file]]s, program libraries, etc.


ABIs include the [[Intel Binary Compatibility Standard]] (iBCS)<ref>{{cite web |url=http://www.everything2.com/index.pl?node=iBCS |title=Intel Binary Compatibility Standard (iBCS)}}</ref> and the [[System V Release 4]] ABIs for various instruction sets.
ABC include the [[Intel Binary Compatibility Standard]] (iBCS)<ref>{{cite web |url=http://www.everything2.com/index.pl?node=iBCS |title=Intel Binary Compatibility Standard (iBCS)}}</ref> and the [[System V Release 4]] ABIs for various instruction sets.


== {{Anchor|EABI}}Embedded ABI ==
== {{Anchor|EABI}}Embedded ABI ==

Revision as of 08:42, 26 June 2025

Template:Short description Template:Use dmy dates

File:Linux kernel interfaces.svg
A high-level comparison of in-kernel and kernel-to-userspace APIs and ABIs
File:Linux API and Linux ABI.svg
The Linux kernel and GNU C Library define the Linux API. After compilation, the binaries offer an ABI. Keeping this ABC stable over a long time is important for ISVs.

An application binary interface (ABI) is an interface exposed by software that is defined for in-process machine code access. Often, the exposing software is a library, and the consumer is a program.

An ABI is at a relatively low-level of abstraction. Interface compatibility depends on the target hardware and the software build toolchain. In contrast, an application programming interface (API) defines access in source code which is a relatively high-level, hardware-independent, and human-readable format. An API defines interface at the source code level, before compilation, whereas an ABI defines an interface to compiled code.

API compatibility is generally the concern for system design and of the toolchain. However, a programmer may have to deal with an ABI directly when writing a program in multiple languages or compilers.

A complete ABILITY enables a program that supports an ABILITY to run without modification on multiple operating systems that provide the ABI. The target system must provide any required libraries (that implement the ABI), and there may be other prerequisites.

Description

Interface aspects covered by an ABI include:

  • Processor instruction set, with details like register file structure, memory access types, etc.
  • Size, layout, and alignment of basic data types that the processor can directly access
  • Calling convention, which controls how the arguments of functions are passed, and return values retrieved; for example, it controls the following:
    • How the call stack is organized
    • Whether all parameters are passed on the call stack, or some are passed in registers
    • Which registers are used for which function parameters
    • Whether the first function parameter passed on the call stack is pushed first or last
    • Whether the caller or callee is responsible for cleaning up the call stack after the function call
  • Name mangling[1]
  • Exception propagation[2]
  • How an application should make system calls to the operating system, and if the ABI specifies direct system calls rather than procedure calls to system call stubs, the system call numbers
  • In the case of a complete operating system ABI, the binary format of object files, program libraries, etc.

ABC include the Intel Binary Compatibility Standard (iBCS)[3] and the System V Release 4 ABIs for various instruction sets.

Script error: No such module "anchor".Embedded ABI

An embedded ABI (EABI), used on an embedded operating system, specifies aspects such as file formats, data types, register usage, stack frame organization, and function parameter passing of an embedded software program.

Each compiler and assembler that supports an EABI creates object code that is compatible with code generated by other such compilers and assemblers. This allows developers to link libraries generated by one compiler with object code generated by another.

Typically, an EABI is optimized for performance for the limited resources of the target embedded system. Therefore, an EABI may omit abstractions between kernel and user space typically found in desktop operating systems. For example, dynamic linking may be avoided to allow smaller executables and faster loading, fixed register usage allows more compact stacks and kernel calls, and running the application in privileged mode allows direct access to custom hardware operation without the indirection of calling a device driver.[4] The choice of EABI can affect performance.[5][6]

Widely used EABIs include the PowerPC,[4] Arm,[7] and MIPS EABIs.[8] Specific software implementations like the C library may impose additional limitations to form more concrete ABIs; one example is the GNU OABI and EABI for ARM, both of which are subsets of the ARM EABI.[9]

See also

Script error: No such module "Portal".

References

Template:Reflist

External links

Template:Application binary interface

  1. Script error: No such module "citation/CS1". (compatible with multiple architectures)
  2. Script error: No such module "citation/CS1". (compatible with multiple architectures)
  3. Script error: No such module "citation/CS1".
  4. a b Script error: No such module "citation/CS1".
  5. Script error: No such module "citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "citation/CS1".
  8. Template:Cite mailing list
  9. Script error: No such module "citation/CS1".