pyxherb 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.
`-fno-c++-static-destructors` completely prevents the destructor from running (at least in our practical test, it actually does so), this leads to some resource leaks in our scenario (kernel modules), unless we manually destruct all of the global variables, which will make the codes much more complicated. If there are codes that sort the destructors and put them into the `atexit()` calls in correct order, there may be some ways to implement an equivalent mechanism for .fini_array and let the global variables destruct correctly. But anyway current codes of this PR have to be modified. https://github.com/llvm/llvm-project/pull/211963 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
