The ELF Binary Format
ELF stands for Executable and Linkable Format. It is the file format used for executable files, object files, and libraries. It has long established itself as the standard format under Linux and has replaced the a.out format of the early years. The particular benefit of ELF is that the same file format can be used on practically all architectures supported by the kernel. This simplifies not only the creation of userspace tools, but also programming of the kernel itself — for example, when it is necessary to generate load routines for executable files. However, the fact that the file format is the same does not mean that binary compatibility exists between the programs of different systems — between FreeBSD and Linux, for instance, both of which use ELF as their binary format. Although both organize the data in their files in the same way, there are still differences in the system call mechanism and in the semantics of the system calls. This is the reason why FreeBSD programs cannot run under Linux without an intermediate emulation layer (the reverse is naturally also true). Understandably, binary programs cannot be swapped between different architectures (for example, Linux binaries compiled for Alpha CPUs cannot execute on Sparc Linux), because the underlying architectures are totally different. However, thanks to ELF, the way in which information on programs and their components is coded in the binary file is the same in all cases.
Linux employs ELF not only for userspace applications and libraries, but also to build modules. The kernel itself is also generated in ELF.
ELF is an open format whose specification is freely available (also on the Web site associated with this book). This appendix is structured in the same way as the specification and summarizes information that is relevant.
Continue reading here: E1 Layout and Structure
Was this article helpful?