ELF

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2020 Feb 3 13:12
Editor
Edited
Edited
2026 Aug 25 18:5
Refs
Refs
ldd

Executable and Linking File Format, Extensible Linking Format

오브젝트 파일, 공유 라이브러리, 또는 코어 덤프를 할 수 있게 하는 바이너리 파일\
Windows의 PE .exe, macOS의 Mach-O에 대응되는 게 Linux의 ELF
원래 뜻은 Extensible Linking Format 이라는 뜻
각 ELF 파일은 하나의 ELF 헤더와 파일 데이터로 이루어진다
  • Header
  • program header table
  • File data (segment)
  • section header table optional
notion image

ELF Types

  • Relocatable: need to be fixed by the linker before being executed
  • Executable: all symbols have been resolved except shared libs
  • Shared: shared libraries with the appropriate linking information
  • Core: core dumps created when a program terminated with a fault
ELF Tools
 
 
ELF Notion
 
 
 
binfmt_elf.c
torvalds
(ELF Loading)
ELF manually reimplements database-like primitives through its symbol table, string table, hash table, and section headers: indexes, foreign keys, schemas, and so on. If SQLite were used as an executable file format instead of ELF:
  • symbol lookup → SELECT
  • readelf, nm, ldd → SQL queries
  • strip → DELETE + VACUUM
  • patchelf → UPDATE
  • library dependencies → foreign keys / joins
You could put the executable and the full closure of its shared libraries into a single database. Then dynamic-linking ambiguity, such as “which exact file is this libc.so.6?”, disappears: the dependency simply becomes a foreign key.
The point is not that “SQLite is better for execution.” Rather, making executable files structured, queryable, and mutable would greatly simplify tooling and dependency management. The tradeoffs are also clear: the current prototype has a fixed ~5 ms startup overhead from opening SQLite and running the interpreter, and it is slower than ELF because it cannot directly mmap and share text pages.
 
 

Recommendations