[patch] Emit aliases for more constructors (V2)

Reid Kleckner rnk at google.com
Fri Oct 11 15:17:57 PDT 2013


Aliases seem to be a problem for some linkers.  What do you think about
going forward with the RAUW aproach mentioned here?

+    // FIXME: Instead of outputting an alias we could just replace every
use of
+    // AliasDecl with TargetDecl.

FWIW I tried this but it doesn't work because we emit the globals in the
wrong order for RAUW.

Timur feels strongly that we should simply directly call the base dtor when
there is no complete dtor in the MS C++ ABI.  I want to remove the hack
that makes us do that currently, though.  You can see it just below the
dtor emission call to TryEmitDefinitionAsAlias.

Does "InEveryTU" assume the user is using clang or a compiler that produces
similar aliases (gcc)?  That doesn't seem very good.


On Fri, Oct 11, 2013 at 2:17 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> After spending some time figuring out what the actual restrictions ELF
> puts on alias I think this new patch is correct.
>
> What the previous one was getting wrong is that sometimes it would
> output just the base destructor. If we are using aliases and
> implementing weak functions with comdats, we have to make sure every
> translation unit emits comdats with the same symbols. If we don't, the
> linker can decide to keep a copy that has only the base destructor and
> the link gets an undefined reference to the complete destructor.
>
> I have tested the patch by using a patched clang to build a debug
> version of clang.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131011/ceacba1c/attachment.html>


More information about the cfe-commits mailing list