rnk added a comment.

Well, I guess we're out of luck, but that seems like a very poorly considered 
requirement from the standard. If we can't use comdats for inline variables, 
every time you include a header with a dynamically initialized variable, it 
will generate extra initialization code in every TU that cannot be optimized 
away. This reminds me of the problems people used to have where every TU 
including <iostream> emitted extra initialization code.

I think we have two options:

1. Full conformance: Stop using comdats altogether and suffer costs in code 
size and startup time
2. Partial / compromised conformance: Provide ordering guarantees between 
global_ctors entries so that we can ensure that inline variables in headers 
have the expected initialization order


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126341

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D126341: Order impli... Reid Kleckner via Phabricator via cfe-commits

Reply via email to