tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Trivial program size inflation



mouse%Rodents-Montreal.ORG@localhost (Mouse) writes:

>>>>> amd64, 9.0_STABLE (ftp.n.o):

>>>>>    text    data     bss     dec     hex filename
>>>>>  562318   29064 2176416 2767798  2a3bb6 main

>> amd64, 9.0_STABLE:
>>    data     bss     dec     hex filename
>>    2873     186      72    3131     c3b a.out

>Is that linked dynamic, or did you stub out all the miscellanous junk?
>Is that what the code you quote (below, which I'm cutting) is?


c.c is the one-line main function.
atexit.c is the quoted code.

% cc -c -fno-common atexit.c
% cc -static c.c atexit.o
% size a.out
   text    data     bss     dec     hex filename
   2873     186      72    3131     c3b a.out




>> crt0 pulls in
>> - atexit
>> - environment
>> - static TLS
>> - stack guard

>Why TLS??  Is there some networking going on under the hood?

Thread Local Storage.



>Still, I would have expected all that to be done via weak symbols, so
>if they aren't needed they aren't brought in.  For example, there's no
>need for the atexit support if the program never uses it,

The atexit() functionality is used in the startup code. And everything
else is pulled in from libc_init.






Home | Main Index | Thread Index | Old Index