I am trying to understand the concept of Application binary interface (ABI).
From The Linux Kernel Primer:
An ABI is a set of conventions that allows a linker to combine separately compiled modules into one unit without recompilation, such as calling conventions, machine interface, and operating-system interface. Among other things, an ABI defines the binary interface between these units. ... The benefits of conforming to an ABI are that it allows linking object files compiled by different compilers.
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.
- I was wondering whether ABI depends on both the instruction set and the OS. Are the two all that ABI depends on?
What kinds of role does ABI play in different stages of compilation: preprocessing, conversion of code from C to Assembly, conversion of code from Assembly to Machine code, and linking?
From the first quote above, it seems to me that ABI is needed for only linking stage, not the other stages. Is it correct?
When is ABI needed to be considered?
Is ABI needed to be considered during programming in C, Assembly or other languages? If yes, how are ABI and API different?
Or is it only for linker or compiler?
- Is ABI specified for/in machine code, Assembly language, and/or of C?