How to Create Really Teensy ELF Executables for Linux

Creating Teensy ELF Executables for Linux (Or, "Size Is Everything")

This tutorial dives into the art of shrinking Linux executables to their absolute minimum size. Starting with a simple C program that returns 42, the author progressively strips away layers of overhead—switching to assembly, bypassing startup files, and ultimately making direct system calls. The journey reveals the inner workings of the ELF format and Linux's system call interface, culminating in a 368-byte executable. A must-read for anyone fascinated by low-level programming and software minimalism.

If you're a programmer who's become fed up with software bloat, then may you find herein the perfect antidote.
  1. WalterGR

    Part 2: https://www.muppetlabs.com/~breadbox/software/tiny/revisit.h...

    Discussed here a couple months ago: https://news.ycombinator.com/item?id=48654411

    Part 3: https://www.muppetlabs.com/~breadbox/software/tiny/somewhat....

  2. BruceEel

    This is actually a lot of fun. Never did it on Linux, but Windows PE EXE files make similar tricks possible. Windows 95 in particular was very permissive. Using a (very primitive, by today's standards) hex editor I tried making the ".text" section begin halfway through the header and bang! ..it worked, a revelation of sorts. I imagine today's loaders may be a bit more strict because of security but I guess you can always make your own loader :)

  3. davidwritesbugs

    I wonder how much of this could be done by a clever linker? There’s a lot of skill in there but how would an llm do, for the rest of us?

More from this day

2026-08-30