Linux.com

ELF header

Link to this post 24 Sep 10

what is the ELF header for an executable linux binary

Link to this post 24 Sep 10

Have you attempted to use "readelf -h {executable file}" to examine the elf headers for various files to compare the data in the headers?

Link to this post 29 Sep 10

All an ELF header *really* does is explain to the kernel a little bit about what the file is and what it does, and what it's for. That is to say, is it an executable, or a library? Is it for my architecture, or other architecture? Assuming it's an executable for my architecture, how much memory should I reserve for this thing? What other bits of data should I load into memory? Does it require my to load any other libraries?

Pretty much all operating systems today require some kind of header like this on executables. Windows uses one called PE. The most recent example I can think of where this was not the case was the old .com executable format for DOS where the code in a .com file was meant to be run on bare metal (e.g. no memory management from the OS, and little or no functionality from the OS other than the interupts it may have overwritten in memory). The requirement for access to more and more memory, and the need for multitasking and interaction with services provided by an OS had lead to these executable headers.

ELF happens to be a very portable / popular standard. It's an Open format available to any OS / Platform, and specifically provides a way to embed information about the intended platform of the code that is universally readable. A lot of OSs and platforms today use ELF or some variation of ELF.

Wikipedia has a decent enough article about ELF.

Also, you can read the man pages for readelf, objdump, file, and magic for a little more information.

Basically, the ELF header is built by the linker when you are building software (man ld)

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board