Table of Contents

OS / Linux - Executable and Linkable Format (ELF)

About

The Executable and Linkable Format (ELF, formerly named Extensible Linking Format), is a object file format (executable files and shared libraries) used also for core dumps.

Format

Elf

The format of an ELF follows the structure of the object file format.

A program is divided into sections and uses principally the following:

A program must have at least .text section.

Section

A section is a block of memory that contains either program code or data.

Section Type executable by the CPU Desc
code yes
.data no for storing data
.bss no for storing program data
debug no
# Header
fileName: file format elf64-x86-64
# Series of disassembled sections
Disassembly of section .interp:
...
Disassembly of section .note.ABI-tag:
...
Disassembly of section .note.gnu.build-id:
...
...
etc

# Row in section with three columns
4004d6: 55 push rbp
# Row in section with an optional fourth column for comment
lea r12,[rip+0x2008ee] # 600e10 <__frame_dummy_init_array_entry>

where:

Text Section

Example of text section with two functions:

00000000004003e0 <_start>:
4003e0: 31 ed xor ebp,ebp
4003e2: 49 89 d1 mov r9,rdx
4003e5: 5e pop rsi
...more assembly code....
0000000000400410 <deregister_tm_clones>:
400410: b8 3f 10 60 00 mov eax,0x60103f
400415: 55 push rbp
400416: 48 2d 38 10 60 00 sub rax,0x601038
...more assembly code....

where:

Management

See

Documentation / Reference