[comp.unix.questions] size of executables

pefv700@perv.pe.utexas.edu (12/01/90)

I am trying to write my own version of cat(1) in C.  When I use default
options for cc(1) (and those of ld(1)), for smallish programs, the
executable size is always 24576 bytes.  The only way I have found to
reduce that is strip(1), which reduces the size to 16384 bytes.  By 
comparison, /bin/cat is only 6312 bytes.

I am using SunOS 4.? and have RTM but the options that deal with size
(-S for cc and -x and -X for ld -- of course -s for cc is the same as strip)
don't change anything.  

Even a program which does nothing is 24576 bytes:

skelly% cat nothing.c
main() { }
skelly% cc nothing.c
skelly% ls -l a.out
-rwx------  1 pefv700     24576 Nov 30 11:29 a.out

What am I missing?

+-------------------------------+--------------------------------------------+
| Christopher Phillips          |        #include "stupid_UNIX_quotes.h"     |
| pefv700@skelly.pe.utexas.edu  |           When in doubt, push pawn.        |
+-------------------------------+--------------------------------------------+

dan@kfw.COM (Dan Mick) (12/04/90)

In article <40449@ut-emx.uucp> pefv700@perv.pe.utexas.edu writes:

:Even a program which does nothing is 24576 bytes:
:
:skelly% cat nothing.c
:main() { }
:skelly% cc nothing.c
:skelly% ls -l a.out
:-rwx------  1 pefv700     24576 Nov 30 11:29 a.out
:What am I missing?

File padding to page sizes.  Try fooling with ld switches -n and -N.