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

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 10:32:37 PST 2024


PiJoules wrote:

(Sorry I think I accidentally edited your last comment rather than adding a new one)

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

Fewer atexit calls means fewer calls to malloc since the number of callbacks can dynamically grow.

> 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.

Good points, I'll have to write more tests for this

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


More information about the cfe-commits mailing list