blog.weineng.me

The smallest C binary (opens in new tab)

Covers Apollo Guidance ComputerCovered by lobste.rs, HackadayDiscussed on Hacker News and Lobsters

I thought of a cute problem: what is the smallest (size) ./a.out binary I can create? Here are some rules the program should follow: ./a.out must run successfully. $? must deterministically be 0. The binary must be produced by GCC only; no post-processing with objcopy, hex editors, or manual patching. We begin with the simplest program possible: // compiled with gcc empty.c int main() { return 0; } This gives us a file size of 15816 bytes (from stat). Not too shabby, but we will need four of ...

Read the original article
Sign in to keep reading the full article.

Covered in 2 articles

lobste.rs·
Discussed on r/C_Programming and r/cpp
Feeds
Hackaday·
Feeds

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help