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] ELF Header
ELF 란 용어를 많이 들어보셨을텐데요, ELF는 Executable and Linking Format의 약어입니다. UNIX / LINUX 기반에서 사용되는 실행 및 링킹 파일 포맷입니다. 이번 글에서는 ELF 파일 포맷에 대해 알아보겠습니다. ELF는 하나의 ELF Header와 파일데이터로 구성되어 있습니다. 아래 그림을 보시면 파일의 가장 위에 ELF Header 정보가 들어있고, 그 아래 program header table이 있습니다.
[ELF] ELF Header
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
  • stripDELETE + VACUUM
  • patchelfUPDATE
  • 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.
Your executable is a SQLite database
I have been probably obsessed with two things in the last few years: Nix as a tool to explore innovative ideas that require the capability to rebuild the world and replacing ELF with SQLite as an executable format. You might have noticed that these two ideas are well suited to each other.
 
 

Recommendations