[clang] [clang][Fuchsia] Have global dtors use llvm.global_dtors over atexit (PR #115788)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 20:48:32 PST 2024


efriedma-quic 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?

>>Also, I'm not sure objects are destroyed in the correct order.

>Do you mean for the test case I added? I think they should be destroyed in reverse order.

No, I mean for objects in different translation units.  I think the same translation unit works like you think.  And different translation units maybe works for non-inline variables, assuming the loader iterates in the right direction?

I think you might run into issues with inline variables?  Not sure if this patch actually changes behavior for them.

https://github.com/llvm/llvm-project/pull/115788


More information about the cfe-commits mailing list