Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jjohn (22)

jjohn
  (email not shown publicly)
http://taskboy.com/
AOL IM: taskboy3000 (Add Buddy, Send Message)

Perl hack/Linux buff/OSS junkie.

Journal of jjohn (22)

Thursday June 02, 2005
02:20 PM

Adventures in static linking

[ #25016 ]
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!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • That is what you expect with static linking, is it not? I'm not sure you could say there's anything "wrong."

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • 4000x increase?! That's a meaty runtime! 16K, 32K or 64K would be what I would have expected.
      • I presume it's linking in libc.a. Here are some libc.a sizes on systems I have access to at the moment:

        • Cygwin: 781142 bytes
        • SunOS 5.8: 1790056 bytes
        • Sparc64 Linux: 2825144 bytes
        • ix86 Linux: 2233342 bytes

        Maybe that's a lot larger than it was back in the day, but it seems about right to me.

        --
        J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers