Improved mac support
This commit is contained in:
30
src/os/linux/elf/elf.md
Normal file
30
src/os/linux/elf/elf.md
Normal file
@ -0,0 +1,30 @@
|
||||
# ELF
|
||||
|
||||
## Basic structure
|
||||
|
||||
1. ELF header (0x00 - 0x40)
|
||||
2. Program header (0x40 - 0x78)
|
||||
3. Padding (0x78 - 0x80)
|
||||
4. Machine code (0x80)
|
||||
|
||||
## Entry point
|
||||
|
||||
The entry point is defined in the first 64 bytes (ELF header).
|
||||
|
||||
## 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
|
||||
|
||||
ELF loader:
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/binfmt_elf.c
|
||||
|
||||
ELF register definitions:
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/elf.h
|
Reference in New Issue
Block a user