[libcxx-commits] [PATCH] D155278: [libc++][mingw] TLS cleanup on windows
Karl-Johan Johnsson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 20 09:45:56 PDT 2023
kalle-llvm added a comment.
In D155278#4510247 <https://reviews.llvm.org/D155278#4510247>, @mstorsjo wrote:
> I guess relevant cases to test is both when libc++ lives in its own DLL and when it is statically linked into the main executable (they have slightly different destructor execution orderings). If we can see that duplicate execution is safe here, or that we're sure that the atexit callback gets called before the tls slot destructors for the main thread, then this should probably be fine.
@mstorsjo You're right, there are several configurations that should be tested. I'm currently on vacation and will be away for another two weeks. When I'm back I will make the tests and report back.
I've also been thinking about what happens if a global destructor uses exception handling internally after the tls slot has been freed (if it comes later in the atexit list). As the patch stands now, it will pick up a stale tls slot which is obviously not good, so the destroy function should really zero out the tls key after it frees it. Then maybe __cxa_get_globals will trigger a new tls slot allocation (with a new atexit destructor) and things will just work. Or not. I will try to investigate this in more detail.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155278/new/
https://reviews.llvm.org/D155278
More information about the libcxx-commits
mailing list