I just read an example of ABI. Is it correct that
an ABI is similar to API, except that ABI is in machine language and API is in a high level programming language
an ABI is the interface provided by and belonging to a compiled library in a machine language? (If I am correct, a self-made compiled library provides its ABI (see the above example). An operating system can be viewed as a compiled library, and thus provides its own ABI for applications to access its system call services.)
The above example doesn't mention whether an ABI of a self-made compiled library depends on the operating system.
https://en.wikipedia.org/wiki/Application_binary_interface mentions operating system however:
ABIs cover details such as:
a processor instruction set (with details like register file structure, stack organization, memory access types, ...)
the sizes, layouts, and alignments of basic data types that the processor can directly access
the calling convention, which controls how functions' arguments are passed and return values are retrieved; for example, whether all parameters are passed on the stack or some are passed in registers, which registers are used for which function parameters, and whether the first function parameter passed on the stack is pushed first or last onto the stack
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
and in the case of a complete operating system ABI, the binary format of object files, program libraries and so on.
Does the ABI of a compiled library depend on the operating system? (I guess no. Even if a compiled library uses system call services via the ABI of the operating system, it is the compiled library not its ABI which depends on (the ABI of) the OS.)
Can the ABI of a compiled library be independent of (the ABI of) the operating system?