[clang] [Clang] Ensure that .fini_array is available with -fno-use-cxa-atexit (PR #211963)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 25 23:03:35 PDT 2026
efriedma-quic wrote:
Running C++ destructors using .fini_array is nowhere near compliant with standard requirements; the standard requires destructors to run in a specific order. And that order exists for good reasons: destruction in the wrong order is likely to lead to use-after-free, or destroying objects which were never constructed.
Are you sure you can't use `-fno-c++-static-destructors`? That suppresses atexit calls in a way that's much less likely to explode.
https://github.com/llvm/llvm-project/pull/211963
More information about the cfe-commits
mailing list