Large code size?

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Wed Mar 31 23:46:00 GMT 1999


> Hmm.  Does the gnu.linkonce trick work for shared libraries?

Yes, it does:

mira% g++ -c -fPIC -ftemplate-depth-110  a.cc
mira% size a.o
   text    data     bss     dec     hex filename
 128446    9656       1  138103   21b77 a.o
mira% g++ -c -fPIC -ftemplate-depth-110  b.cc
mira% size a.o                               
   text    data     bss     dec     hex filename
 128446    9656       1  138103   21b77 a.o
mira% g++ -shared -o a.so a.o b.o 
mira% size a.so
   text    data     bss     dec     hex filename
 153487   20756      32  174275   2a8c3 a.so

What doesn't work: you can't eliminate template instantiations from a
shared library in the final link of the program.

Regards,
Martin



More information about the Gcc mailing list