Linux — ELF (Executable and Linkable Format), Part 1: Intro

Shlomi Boutnaru, Ph.D.
2 min readAug 25, 2022

--

Every generic/standard operating system has a binary format for its user mode executables/libraries, kernel code and more. Windows has PE (Portable Executable), OSX has MachO and Linux has ELF. We are going to start with ELF (I promise to go over the others also).

In Linux ELF among the others (but not limited to) for executables, kernel models, shared libraries, core dumps and object files. Although, Linux does not mandates an extension for files ELF files may have an extension of *.bin, *.elf, *.ko, *.so, *.mod, *.o, *.bin and more (it could also be without an extension).

Moreover, today ELF is a common executable format for a variety of operating systems (and not only Linux) like: QNX, Android, VxWorks, OpenBSD, NetBSD, FreeBSD, Fuchsia, BeOS. Also, it is used in different platforms such as: Wii, Dreamcast and PlayStation Portable.

ELF, might include 3 types of headers: ELF header (which is mandatory), program headers and sections header . The appearance of the last two is based on the goal of the file: Is it for linking only? Is it execution only? Both? (More on the difference between the two in the next chapters).

You can see the different layouts of ELF in the image below (https://i.stack.imgur.com/RMV0g.png).

In the next parts we will go over each header in more detail. By the way, a great source for more information about ELF is man (“man 5 elf”).

You can also check my twitter account — @boutnaru (https://twitter.com/boutnaru)

See you in part 2 ;-)

“Linking View” vs “Execution View” of an ELF file

--

--