[libc-commits] [libc] [libc][patch 1/n] ensure tls dtors are called in main thread (PR #133641)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Mon Mar 31 14:57:57 PDT 2025


================
@@ -14,8 +14,12 @@
 namespace LIBC_NAMESPACE_DECL {
 
 extern "C" void __cxa_finalize(void *);
+extern "C" [[gnu::weak]] void __cxa_thread_finalize();
 
+// TODO: use recursive mutex to protect this routine.
----------------
SchrodingerZhu wrote:

AFAIK, the weak symbol approach is also used in __cxa_finalize (for tearing down TLS). 

I remember the reason is that some code is supposed to be used in overlay mode. 

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


More information about the libc-commits mailing list