[vox-tech] Understanding a C hello world program
Ken Bloom
kabloom at ucdavis.edu
Wed Nov 24 11:23:03 PST 2004
On Wed, Nov 24, 2004 at 11:10:34AM -0800, Mark K. Kim wrote:
> On Wed, 24 Nov 2004, Peter Jay Salzman wrote:
> [snip]
> > p at satan$ size hello_world-1.o
> > text data bss dec hex filename
> > 48 0 0 48 30 hello_world-1.o
> [snip]
>
> What the... how did you make your program so small? My output:
>
> $gcc hello.c -o hello
> $size hello
> text data bss dec hex filename
> 960 256 4 1220 4c4 hello
> $strip hello
> $size hello
> text data bss dec hex filename
> 960 256 4 1220 4c4 hello
> $ls -l hello
> -rwxr-xr-x 1 mark mark 2948 Nov 24 10:24 hello*
> $gcc --version
> gcc (GCC) 3.3.5 (Debian 1:3.3.5-2)
> [snip]
>
> -_-'
He's working with hello.o, the output of gcc -c hello.c
You're working with hello, the output of gcc -o hello hello.c
So yours is a completely linked version of the file, and his is the
object file pre-linking. He could use ld -o hello $LIBARIES hello.o to
get what you have.
--Ken Bloom
--
I usually have a GPG digital signature included as an attachment.
See http://www.gnupg.org/ for info about these digital signatures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20041124/c5ef2d62/attachment.bin
More information about the vox-tech
mailing list