在 2024-12-06 07:20, Martin Storsjö 写道:
Thanks - so I guess this patch could be pushed on its own, even if we don't yet figure out a good way forward with the other one.
This patch is OK for me. (because it's simple; not because it's perfect.)
If we could force libstdc++ to prefer providing its own __cxa_thread_atexit, which uses __gthread_key_create for registering the destructor, then we'd have both emutls and __cxa_thread_atexit dtors registered via the one and same mechanism, and they both should execute in a consistent order.
I suspect it can also happen if the cleanup callback of a pthread key references another thread-local object and re-creates emutls storage after it has been deallocated. Maybe in practice little such code ever exists.
But getting rid of our __cxa_thread_atexit, or making it available only in some build configurations, also seems messy and like a step backwards...
The source of this issues seems to be that emutls should have been special. Thus a proper fix would be to move to native TLS, possibly at some time in the future.
-- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public