Adventures in static linking

Posted:

What’s wrong with this screen dump? [jjohn@localhost hello]$ gcc -Wall -static hello.c [jjohn@localhost hello]$ file a.out a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, statically linked, not stripped [jjohn@localhost hello]$ ls -l total 424 -rwxrwxr-x 1 jjohn jjohn 424535 Jun 1 17:50 a.out -rw-rw-r— 1 jjohn jjohn 90 Jun 1 17:50 hello.c [jjohn@localhost hello]$ ./a.out Hello

Good gravy, that’s one fine statically compiled binary that’s more than 4000 times the size of the source code. It doesn’t just print “Hello”, it prints the hell of out it!

[Original use.perl.org post and comments.]