[PATCH] D106925: COFF/ELF: Place llvm.global_ctors elements in llvm.used if comdat is used

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 28 09:41:21 PDT 2021


MaskRay added a comment.

In D106925#2910638 <https://reviews.llvm.org/D106925#2910638>, @rnk wrote:

> lgtm
>
> So the main impact here is that, on ELF, linker GC will no longer be able to GC vague linkage global variables with dynamic initializers. Those are things like
>
> - C++17 inline globals
> - selectany globals
> - static data members of class template instantiations
>
> Seems reasonable to me.

That is it! The ELF linker GC is similar to link.exe GC in this regard: ctor sections in a group/COMDAT are not special (GC roots).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106925/new/

https://reviews.llvm.org/D106925



More information about the cfe-commits mailing list