Application binary interface: Difference between revisions

Content deleted Content added
m Change link to 'M•CORE Applications Binary Interface Standards Manual' to point to the Wayback Machine archived version, as the nxp website does not have the file anymore
Multiple compilers for the *same* language, presumably; multiple compilers for multiple languages is usually the case.
 
(22 intermediate revisions by 6 users not shown)
Line 1:
{{short description|BinaryInterface interfaceto betweensoftware twodefined programin unitsterms of in-process, machine code access}}
{{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 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]].]]
 
In [[computer software]], anAn '''application binary interface''' ('''ABI''') is an [[interface (computing)|interface]] betweenexposed twoby binary[[software]] programthat modules.is Often,defined one of these modules is afor in-[[LibraryProcess (computing)|libraryprocess]] or [[operatingmachine systemcode]] facilityaccess. Often, and the otherexposing software is a program[[Library that(computing)|library]], isand beingthe runconsumer byis a user[[computer program|program]].
 
An ABI definesis howat dataa structuresrelatively orlow-level computationalof routines[[abstraction are(computer accessedscience)|abstraction]]. inInterface compatibility depends on the target [[machinecomputer codehardware|hardware]], whichand isthe a[[software low-level,build]] hardware-dependent format[[toolchain]]. In contrast, an [[application programming interface]] (API) defines this access in [[source code]], which is a relatively high-level, hardware-independent, oftenand [[human-readable]] format. AAn commonAPI aspectdefines ofinterface an ABI isat the [[callingsource convention]],code which determines how data is provided as input tolevel, orbefore read as output fromcompilation, computationalwhereas routines.an ExamplesABI ofdefines thisan areinterface theto [[x86compiled calling conventions]]code.
 
AdheringAPI to an ABI (which may or may not be officially standardized)compatibility is usuallygenerally the jobconcern of afor [[compilersystem design]], operatingand system,of or librarythe authortoolchain. However, an applicationa [[programmer]] may have to deal with an ABI directly when writing a program in a mix ofmultiple [[programming language|languages,]] or evenwhen compilingusing amultiple program[[compiler]]s written infor the same language with different compilers.
 
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.
 
== Description ==
DetailsInterface aspects covered by an ABI include the following:
* [[Processor (computing)|Processor]] [[instruction set]], with details like register file structure, stack organization,[[Computer memory|memory]] access types, etc.
* SizesSize, layoutslayout, and [[Data structure alignment|alignmentsalignment]] of basic [[data type]]s that the processor can directly access
* [[Calling convention]], which controls how the arguments of [[function (programming)|function]]s 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]]<ref>{{cite web|url=https://itanium-cxx-abi.github.io/cxx-abi/|title=Itanium C++ ABI}} (compatible with multiple architectures)</ref>
* [[exception handling|Exception]] propagation<ref>{{cite web|url=http://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html|title=Itanium C++ ABI: Exception Handling}} (compatible with multiple architectures)</ref>
* How an application should make [[system call]]s to the operating system, and if the ABI specifies direct system calls rather than procedure calls to system call [[Method stub|stubs]], the system call numbers
* 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.
== Complete ABIs ==
A complete ABI, such as the [[Intel Binary Compatibility Standard]] (iBCS),<ref>[http://www.everything2.com/index.pl?node=iBCS Intel Binary Compatibility Standard (iBCS)]</ref> allows a program from one operating system supporting that ABI to run without modifications on any other such system, provided that necessary shared libraries are present, and similar prerequisites are fulfilled.
 
ABIs can also standardize details such as the [[name mangling#Name mangling in C++|C++ name mangling]],<ref>{{cite web|url=https://itanium-cxx-abi.github.io/cxx-abi/|title=Itanium C++ ABI}} (compatible with multiple architectures)</ref> [[exception handling|exception]] propagation,<ref>{{cite web|url=http://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html|title=Itanium C++ ABI: Exception Handling}} (compatible with multiple architectures)</ref> and calling convention between compilers on the same platform, but do not require cross-platform compatibility.
 
== {{Anchor|EABI}}Embedded ABIsABI ==
An '''embedded-application binary interfaceABI''' (EABI), used on an [[embedded operating system]], specifies standardaspects conventionssuch foras [[file format]]s, data types, register usage, [[stack frame]] organization, and function parameter passing of an [[Embedded system|embedded]] software program, for use with an [[embedded operating system]].
 
Each compiler and [[Compilerassembly language|assembler]]s that supportsupports thean EABI createcreates [[object code]] that is compatible with code generated by other such compilers, allowingand assemblers. This allows developers to link libraries generated withby one compiler with object code generated withby another compiler. Developers writing their own [[assembly language]] code may also interface with assembly generated by a compliant compiler.
 
EABIsTypically, arean designedEABI tois optimizeoptimized for performance withinfor the limited resources of anthe target embedded system. Therefore, EABIsan omitEABI mostmay omit abstractions thatbetween are[[User madespace betweenand kernel space|kernel and user codespace]] typically found in complex[[desktop computer|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.<ref name="ppc-eabi">{{cite book
| title = PowerPC Embedded Application Binary Interface: 32-Bit Implementation
| date = 1 October 1995
Line 61 ⟶ 63:
}}</ref>
 
Widely used EABIs include the [[PowerPC]],<ref name="ppc-eabi"/> [[Arm architecture|Arm]] EABI,<ref>{{cite web|url=https://developer.arm.com/architectures/system-architectures/software-standards/abi |title=ABI for the Arm Architecture |publisher=Developer.arm.com |access-date=4 February 2020}}</ref> and [[MIPS architecture|MIPS]] EABIEABIs.<ref>{{cite mailing list |url=https://sourceware.org/legacy-ml/binutils/2003-06/msg00436.html |author=Eric Christopher |title=mips eabi documentation |mailing-list=binutils@sources.redhat.com |date=11 June 2003 |access-date=19 June 2020}}</ref> 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 .<ref>{{cite web |title=ArmEabiPort |url=https://wiki.debian.org/ArmEabiPort |website=Debian Wiki |quote=Strictly speaking, both the old and new ARM ABIs are subsets of the ARM EABI specification, but in everyday usage the term "EABI" is used to mean the new one described here and "OABI" or "old-ABI" to mean the old one.}}</ref>
 
== See also ==
{{Portal|Computer programming}}
 
* [[{{Annotated link|Binary-code compatibility]]}}
{{Div col|colwidth=25em}}
* {{Annotated link|Bytecode}}
* [[Binary-code compatibility]]
* [[{{Annotated link|Comparison of application virtualization software]]}}
* [[Bytecode]]
* [[{{Annotated link|Debug symbol]]}}
* [[Comparison of application virtualization software]]
* [[{{Annotated link|Foreign function interface]]}}
* [[Debug symbol]]
* [[{{Annotated link|Language binding]]}}
* [[Foreign function interface]]
* [[{{Annotated link|Native (computing)]]}}
* [[Language binding]]
* [[{{Annotated link|Opaque pointer]]}}
* [[Native (computing)]]
* [[{{Annotated link|PowerOpen Environment]]}}
* [[Opaque pointer]]
* [[{{Annotated link|Symbol table]]}}
* [[PowerOpen Environment]]
* {{Annotated link|SWIG}}
* [[Symbol table]]
* [[Visual C++#Compatibility|Visual C++ ABI instability detailsCompatibility]]
* [[SWIG]]
* [[Visual C++#Compatibility|Visual C++ ABI instability details]]
{{div col end}}
 
==References==
Line 93:
* [https://sourceware.org/legacy-ml/binutils/2003-06/msg00436.html MIPS EABI documentation]
* {{webarchive|url=https://web.archive.org/web/20150114065444/http://www.oracle.com/technetwork/server-storage/solaris10/about-amd64-abi-141142.html|title=Sun Studio 10 Compilers and the AMD64 ABI}}{{snd}} a summary and comparison of some popular ABIs
* {{webarchive|url=https://web.archive.org/web/20210311132953/[https://www.nxp.com/docs/en/reference-manual/MCOREABISM.pdf|title= M•CORE Applications Binary Interface Standards Manual}}] for the Freescale [[M·CORE]] processors
 
{{Application binary interface}}