Re: template instantiation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



brac37 <MichieldeB@xxxxxxx> writes:

> I have read that g++ supports the Borland model for removing duplicate
> template instantiation (elf_i368, ld version 2.20 >= 2.8). However, when I
> compile with the -frepro option, my executable gets smaller? What is the
> reason of that?

I assume you know that -frepo does not select the Borland model, which
is what g++ does by default.  When using -frepo object files should be
smaller, but the executable should be approximately the same size, not
counting debug info.  What does the "size" program report?

When using the default Borland model with released versions of g++ the
duplicate debug info is not eliminated.  This should be much better with
the next release of gcc, 4.6.


> Another thing is that when I compile with  -fno-implicit-templates
> -DNO_IMPLICIT_TEMPLATES, my object file gets very large, because I do every
> possible template instantiation, but I do not care. What I do care is that
> the linker ld does not throw away unused template instantiation when
> generating the executable. Can I tell ld to do so?

Yes, by using the --gc-sections option.  From the compiler driver, write
-Wl,--gc-sections.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux