What if the file you chmod +x and run were itself a database? Farid Zakaria’s SELF prototype (Structured Executable & Linkable Format) replaces ELF with SQLite — the executable is a real SQLite file, and every tool that reads ELF reduces to a SQL query.

The core argument: ELF is already a database that refuses to admit it.

  • .strtab is string interning, .gnu.hash is a hand-rolled index, st_name offsets are foreign keys done by hand, and strip is a DELETE + VACUUM
  • Every consumer — kernel, ld.so, binutils, LIEF — re-implements the same parser against a terse, schema-less format designed for 1970s disk constraints

How SELF works:

  • Two tables to run: self_meta (the ELF header) and segments (load image, bytes as BLOBs); symbols, imports, and exports are SQL tables and views
  • SQLite’s application_id is stamped SELF at byte 68; Linux binfmt_misc magic hands the file to a small C interpreter that maps segments, relocates, and jumps to entry — a miniature ld.so
  • An rtld-audit library answers library lookups with SQL on unmodified glibc; a prototype self-ld does relocation resolution entirely in SQL

The honest costs: SELF files are roughly 2× ELF (b-tree overhead) — but within 1% after stripping, since the overhead lives in optional tooling tables. Startup adds a fixed ~5 ms plus a copy of the image, because b-tree pages aren’t mmap’d and two processes don’t share text pages the way ELF does.

The payoff is the fun part:

  • A closure is one file holding a program plus all transitive dependencies, with dependency resolution as actual foreign keys — ldd becomes a JOIN
  • Pointed at every binary on PATH: 723 executables and 400 libraries become 1,123 objects in one 612 MB SQLite file — smaller than the 644 MB of ELF it came from
  • LD_PRELOAD is a row in a table, so interposing a tracing malloc across a whole userland and rolling it back is a single transaction

A radical idea backed by working code — lossless ELF round-trips, a bootable NixOS VM, real benchmarks — not a manifesto. Even if SELF never ships, the framing of ELF’s ad-hoc structures as reinvented database primitives is a useful mental model on its own.