[PATCH] [ms-cxxabi] Emit linkonce complete dtors in TUs that need them
rnk at google.com
Sun Jul 7 10:54:37 PDT 2013
On Fri, Jun 28, 2013 at 7:02 PM, Reid Kleckner <rnk at google.com> wrote:
> Hi rjmccall,
> Based on Peter Collingbourne's destructor patches.
> Prior to this change, clang was considering ?1 to be the complete
> destructor and the base destructor, which was wrong. This lead to
> crashes in TUs with non-inline dtors where both complete and base dtors
> would be emitted and mangle to the same symbol.
> Furthermore, TUs with non-inline dtors don't emit a complete destructor.
> They are emitted as inline thunks in TUs that need them, and they always
> delegate to the base dtors of the derived class and its virtual bases.
> This change uses the DeferredDecls machinery to emit them. There are
> comments in EmitDestructorBody() that suggest this won't work when the
> body of the dtor is a try block, but this is how cl.exe does things.
> Finally, for classes that don't use virtual inheritance, MSVC always
> calls the base destructor (?1) directly. This is a useful code size
> optimization that avoids emitting lots of extra thunks or aliases.
> Implementing it also means our existing tests continue to pass, and is
> consistent with MSVC's output.
> We could probably do the same for Itanium without breaking anything.
> There is an existing -mconstructor-aliases that makes the complete dtor
> a linker alias, but it is off by default.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits