[patch] Add support for putting constructors and destructos in explicit comdats
Rafael EspĂndola
rafael.espindola at gmail.com
Thu Sep 4 11:20:08 PDT 2014
I have rebased this patch on top of my refactoring patch since it
makes it quiet a bit simpler. I have attached both.
Because of some bugs in GCC there is a discussion going on
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62306 about the best way
to handle the destructor comdat. The attached patch implements the
suggestion of using a new comdat name.
On 1 September 2014 23:03, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
> There are situations when clang knows that the C1 and C2 constructors
> or the D2 and D2 destructors are identical. We already optimize some
> of these cases, but cannot optimize it when the GlobalValue is
> weak_odr.
>
> The problem with weak_odr is that an old TU seeing the same code will
> have a C1 and a C2 comdat with the corresponding symbols. We cannot
> suddenly start putting the C2 symbol in the C1 comdat as we cannot
> guarantee that the linker will not pick a .o with only C1 in it.
>
> The solution implemented by GCC is to expand the ABI to have a comdat
> whose name uses a C5/D5 suffix and always has both symbols. That is
> what this patch implements.
>
> We could also use C5/D5 for linkonce_odr, but it is probably better to
> change one at a time.
>
> Cheers,
> Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refactor.patch
Type: text/x-patch
Size: 25494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140904/7e4a1300/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: comdat.patch
Type: text/x-patch
Size: 25697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140904/7e4a1300/attachment-0001.bin>
More information about the cfe-commits
mailing list