Jump to content

Executable and Linkable Format

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Shellreef (talk | contribs) at 05:48, 26 February 2007 (External links: add freebsd handbook link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
ELF
Filename extension
none, .o, .so
Developed byUnix System Laboratories
Type of formatBinary, executable, object, shared libraries, core dump

In computing, the Executable and Linking Format (ELF, formerly called Extensible Linking Format) is a common standard file format for executables, object code, shared libraries, and core dumps. First published in the System V Application Binary Interface specification, and later in the Tool Interface Standard, it was quickly accepted among different vendors of Unix systems.

Today the ELF format has replaced executable formats such as a.out and COFF in the Linux, Solaris, IRIX, FreeBSD, NetBSD, and OpenBSD operating systems (DragonFly BSD was forked from FreeBSD after the switch to ELF). Because other formats are proprietary, platform-specific, or less extensible than ELF, some users hold that ELF outperforms other formats, whereas others may consider it a competitor to the other formats. ELF is also used in the Itanium version of OpenVMS, a non-UNIX based operating system, as well as replacing the Portable Executable on BeOS Revision 4 and later for x86 based computers (PPC computers stayed with Preferred Executable Format, having never used Portable Executable), which are also not UNIX-based. The PlayStation 2 console and PlayStation Portable also uses ELF as its executable file format.

ELF file layout

Each ELF file is made up of one ELF header, followed by zero or more segments and zero or more sections. The segments contain information that is necessary for runtime execution of the file, while sections contain important data for linking and relocation. Each byte in the entire file is taken by no more than one section at a time, but there can be orphan bytes, which are not covered by a section. In the normal case of a UNIX executable one or more sections are enclosed in one segment. The segments and sections of the file are listed in a program header table and section header table respectively.

On many UNIX systems the command

man elf

may provide some more details.

Tools

  • readelf is a UNIX binary utility that displays information about one or more ELF files. A GPL implementation is provided by GNU Binutils.
  • elfdump is a Solaris command for viewing ELF information in an elf file.
  • objdump provides a wide range of information about ELF files and other object formats.

See also