Master the fundamental concepts of linkers & loaders through this focused micro-challenge.
The kernel's loader (ELF interpreter ld-linux-x86-64.so.2, Windows PE loader) reads the executable header, maps segments into virtual memory, sets permissions (RX for code, RW for data), and jumps to the entry point.
Parse ELF PT_LOAD segments. mmap each at preferred or ASLR-randomized address. Zero BSS. Apply relocations for PIE. Transfer control to _start, which calls __libc_start_main then main.
cLoading…
execve is the syscall that starts loadingProduction compilers embed this step inside a longer pipeline. GCC flows through cpp, cc1, assembly, and ld; Clang uses the driver, Sema, LLVM IR passes, and a target backend. LLVM bitcode, JVM bytecode, and WASM are other familiar IRs at the same layer. The exercise isolates one pass so you can test it alone before chaining it to the next stage.
You will implement a simple program loader that maps segments and jumps to entry. This exercise requires parsing load headers, simulating memory mapping, and transferring control to the program start address.
Implement simple program loader for ELF executables.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github