This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Giant executables.. what am I doing wrong?
- From: Ruppert <ru at swb dot siemens dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 15 Oct 2002 14:31:12 +0200 (MEST)
- Subject: Re: Giant executables.. what am I doing wrong?
- Reply-to: Ruppert <ru at swb dot siemens dot de>
...
> 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.
-- D.Ruppert