Giant executables.. what am I doing wrong?
Tue Oct 15 05:31:00 GMT 2002
> If you run 'nm' on your pre-stripped executable you will see all the
> compiled in functions from the C library and any other libraries. When you
> do a static compile it doesn't just include only the needed function(s), but
> the entire C library .a file. That's why I recommended going with a smaller
> or more base-functionality C library such as newlib.
No. The linker will extract the modules from the archive file (.a)
on a "per object" base. Thus if you use strcpy in your program the
module which contains the definition of strcpy (usually strcpy.o)
gets copied from the archive file to your executable. A archive file
is, in fact, only a collection of individual objects pasted together
and augmented by a common table of symbols.
I would also recommend using 'nm'. This provides detailed insight into
what constitutes your executable.
More information about the Gcc-help