27 lines
468 B
Markdown
Raw Normal View History

2023-10-17 18:29:36 +00:00
# ELF
2023-10-18 15:03:31 +00:00
## Basic structure
2023-10-17 18:29:36 +00:00
2023-10-18 15:03:31 +00:00
1. ELF header (0x00 - 0x40)
2. Program header (0x40 - 0x78)
3. Padding (0x78 - 0x80)
4. Machine code (0x80)
2023-10-17 18:29:36 +00:00
## Entry point
The entry point is defined in the first 64 bytes (ELF header).
2023-10-18 15:03:31 +00:00
## Base address
The minimum base address is controlled by the `mmap` settings:
```shell
sysctl vm.mmap_min_addr
```
Usually, this value is 65536 (0x1000).
## Initialization in Linux
See `/lib/modules/$(uname -r)/build/arch/x86/include/asm/elf.h`.