[PATCH] D106925: COFF/ELF: Place llvm.global_ctors elements in llvm.used if comdat is used
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 28 09:33:04 PDT 2021
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.
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.
================
Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:559
+ getContext().GetGVALinkageForVariable(D) == GVA_DiscardableODR ||
+ D->hasAttr<SelectAnyAttr>()) {
// C++ [basic.start.init]p2:
----------------
My first thought is that the selectany attribute should control the GVA_Linkage in the AST, but it looks like that doesn't happen right now. This is just refactoring the condition below.
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