Of course, 4K is in the noise on a machine with 32 Gig or more of memory.
The old PDP-11 could put a 136 byte executable (assuming the standard UNIX V6 a.out header
into two 64 byte chunks of memory. Not too shabby even in those days.
On Oct 19, 2017, at 9:31 PM, Lyndon Nerenberg
<lyndon(a)orthanc.ca> wrote:
On Oct 19, 2017, at 6:27 PM, Dan Cross
<crossd(a)gmail.com> wrote:
macOS requires you to have a data section aligned to 4K, even if you
don't use it. The resulting binary is a little over 8K; again, mostly
zeros.
There are parlor tricks people play to get binary sizes down to
incredibly small values, but I found the results interesting. Building
the obvious C program on a PDP-11 running 7th Edition yields a 136
byte executable, stripped. Still infinitely greater than /bin/true in
the limit, but still svelte by modern standards.
No matter how tiny you can make the a.out, the kernel's still going to have to map
in at least one page to hold it, so you're eating a minimum of 4K on any modern
machine, regardless.