Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is ABI(Application Binary Interface)?

This is what wikipedia says:

In computer software, an application binary interface (ABI) describes the low-level interface between an application (or any type of) program and the operating system or another application.

ABIs cover details such as data type, size, and alignment; the calling convention, which controls how functions' arguments are passed and return values retrieved; the system call numbers and how an application should make system calls to the operating system; and in the case of a complete operating system ABI, the binary format of object files, program libraries and so on. A complete ABI, such as the Intel Binary Compatibility Standard (iBCS), 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.

I guess that an ABI is a convention or standard, and compilers/linkers use this convention to produce object codes. Is that right? If so who made these conventions(companies or some organization)? What was it like when there was no ABIs? Is there documents about these ABIs that we can refer to?

like image 725
Haiyang Avatar asked Jan 27 '11 10:01

Haiyang


People also ask

What is the role of ABI Application Binary Interface )?

Application Binary Interface (ABI) describes a low-level interface between two applications or an application and operating system. ABI covers data type, size, alignment, calling convention, the system call numbers and how an application should make system calls to OS.

What is ABI Application Binary Interface in Ethereum?

The Contract Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Data is encoded according to its type, as described in this specification.

What does ABI mean in programming?

(Application Binary Interface) A specification for a specific hardware platform combined with the operating system.

What does ABI stand for C++?

As C++ evolved over the years, the Application Binary Interface (ABI) used by a compiler often needed changes to support new or evolving language features. Consequently, programmers were expected to recompile all their binaries with every new compiler release.


1 Answers

You're correct about the definition of an ABI, up to a point. The classic example is the syscall interface in Linux (and other UNIXes).

They are a standard way for code to request the operating system to carry out certain duties.

As such, they're decided by the people that wrote the OS or, in the case where the syscalls have been added later, by whoever added them (in cases where the OS allows this). For example, the Linux syscall interface on x86 states that you load the syscall number into eax, with other parameters placed in ebx, ecx and so on, depending on the syscall you're making (eax).

Typically, it's not the compiler or linker which do the work of interfacing, rather it's the libraries provided for the language you're using.

Returning to Linux, the GNU C libraries contain code for fopen (for example) which eventually call the relevant syscall to perform the lower level tasks (syscall number 5, open). A list of the syscalls can be found in this PDF file.

like image 134
paxdiablo Avatar answered Oct 13 '22 21:10

paxdiablo