[BUG] ld behavior varies for C++ static initializer depending on .a or .o input

Alexandre Oliva aoliva@redhat.com
Sat Apr 12 05:43:00 GMT 2003


On Apr 12, 2003, Hal Black <hablack@vt.edu> wrote:

> Why should it be different for a .a file with the same .o files in
> it?  Should .a files not be used for C++?

Because .o files are copied to the output, whereas .a files are used
as libraries, i.e., only members that offer symbols that are being
looked for are copied to the output.  Can you imagine the bloat if any
time you linked with a static library, all of the code in it was
copied to your executables?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Binutils mailing list