Size Is Everything: Making Tiny ELF Binaries
Milk Toast writes "According to this article one can start with a simple program consisting of 3998 bytes and reduce it down to a mere 45 bytes. Now if they could only reduce the size of my Office install." It involves digging into assembly, naturally, but it's interesting to see the extra code generated not only by the compiler, but by the other steps along the way.
and they want their "news" back.
Should ELF binaries not normally be really small?
In fact, I first heard about it here...
I believe posters are recognized by their sig. So I made one.
And, reading through those comments, that wasn't the first time either... That's actually what I thought, but I couldn't find the link to the even older article quick enough.
I believe posters are recognized by their sig. So I made one.
Man, I've been reading Slashdot way too long.
(It's still a good article though. Worth rereading if you're at all interested in how ELF binaries work.)
It runs and it is only 8 bytes! ./tiny; echo $?
froze@butsuri:~$ cat > tiny
exit 42
froze@butsuri:~$ chmod a+x tiny
froze@butsuri:~$
42
froze@butsuri:~$ wc -c tiny
8 tiny
-- The morphemes of your disquisition are ascertainable, but they have eschewed an ambit of transpicuous exposition.
Erm, i'm not sure its nearly 5 in the morning here but initially he compiles with
gcc -Wall -s -O3 tiny.c
shouldn't
gcc -Wall -s -Os tiny.c
make more sense seeing as how -O(1-3) are for SPEED optimization where as -Os is to make things SMALL
pls. Expose my idiocy...
When you google for ways to fit a program in 512 bytes on the first sector of a floppy, and this is the first article that mentions the options for not using standard include files, etc., it becomes useful.