Added a linker
All checks were successful
/ test (push) Successful in 15s

This commit is contained in:
Eduard Urbach 2025-06-23 16:19:16 +02:00
parent 3ae47f93eb
commit cc2e98ca49
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
26 changed files with 541 additions and 11 deletions

37
docs/elf.md Normal file
View file

@ -0,0 +1,37 @@
# ELF
## Basic structure
1. ELF header [0x00 : 0x40]
2. Program headers [0x40 : 0xB0]
3. Padding
4. Executable code [0x1000 : ...]
5. Padding
6. Read-only data [0x2000 : ...]
7. String table
8. Section headers
## Entry point
The executables are compiled as position-independent executables (PIE). Therefore the entry point is defined as a file offset instead of a static virtual address.
## Padding
To ensure that execution permissions are properly applied,
the code section and the data section are aligned on page boundaries. Permissions like read, write and execute can only be applied to an entire page in memory.
## 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
## Links
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/elf.h
- https://lwn.net/Articles/631631/
- https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
- https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
- https://nathanotterness.com/2021/10/tiny_elf_modernized.html