This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Call complete cdtors instead of base cdtors if they are the same (PR c++/3187)


On Thu, Nov 19, 2009 at 02:29:03PM +0100, Jakub Jelinek wrote:
> Hi!
> 
> So, here is an alternative patch as discussed yesterday.
> Mapping it in the other direction would be harder.
> 
> This patch decreases the size of libstdc++.so.6 only a tiny bit,
> as libstdc++.so.6 heavily uses
> extern template class X<Y>;
> template class X<Y>;
> where both complete and base cdtors are exported even when they aren't used.
> Perhaps on other C++ libraries which don't do this heavily it will have much
> larger effect.

Is it worthwhile to support the opposite transformation when we know
the whole library will be built with GCC?  I'd like to get the size
win on libstdc++, if we can.

Suppose we put both constructors into a single comdat group, but some
other compiler (earlier GCC, or third-party compiler) is used for
additional code linked to the same binary.  The only failure mode
would be duplicate definitions at link time, if C1 is pulled in from
one file and then joint C1/C2 is pulled in to satisfy a reference to
C2.  That means such a command line option would be safe to use; you
could always turn it off if it caused your code not to build.  A
sufficiently clever linker could even discard the C1 when pulling in
the new joint C1/C2 provided a definition of C1.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]