[clang] [clang][Fuchsia] Have global dtors use llvm.global_dtors over atexit (PR #115788)
Daniel Thornburgh via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 10:40:46 PST 2024
mysterymath wrote:
> To ensure we don't destroy objects that weren't constructed, you can use a guard variable of some sort, sure. I'm not quite sure what the goal is, here; are you trying to improve performance, or are you worried about the function pointers for security?
The scenario that brought this up was `constinit` globals still generating constructors that just call `__cxa_atexit`; this behavior was regarded as prima facie "odd", since it invokes quite a lot of mechanism just to register statically-known destructors.
With an approach like this, such constructors wouldn't need to be generated; the little state machine in the module constructor function would take it as granted that such "constructors" executed successfully. We'd probably need some additional mechanism in Clang's data structures to keep track of this though.
https://github.com/llvm/llvm-project/pull/115788
More information about the cfe-commits
mailing list