[libcxx-commits] [PATCH] D135464: [SystemZ][z/OS] Account for no __cxa_thread_atexit_impl on z/OS

Muiez Ahmed via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 7 10:24:34 PDT 2022


muiez created this revision.
muiez added reviewers: ldionne, zibi, fanbo-meng, libc++.
Herald added a project: All.
muiez requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.

The following patch resolves a build error and accounts for no __cxa_thread_atexit_impl on z/OS. It avoids using __thread since thread-local storage is not supported. It should be noted that the fallback implementation uses TLS, which is also not supported on z/OS.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135464

Files:
  libcxxabi/src/cxa_thread_atexit.cpp


Index: libcxxabi/src/cxa_thread_atexit.cpp
===================================================================
--- libcxxabi/src/cxa_thread_atexit.cpp
+++ libcxxabi/src/cxa_thread_atexit.cpp
@@ -27,7 +27,12 @@
   // at runtime, even if libc++ is built against an older libc
   _LIBCXXABI_WEAK
 #endif
+#ifdef __MVS__
+  // FIXME: No __cxa_thread_atexit_impl on z/OS.
+  int __cxa_thread_atexit_impl(Dtor, void*, void*) { return 0; }
+#else
   int __cxa_thread_atexit_impl(Dtor, void*, void*);
+#endif
 
 #ifndef HAVE___CXA_THREAD_ATEXIT_IMPL
 
@@ -67,9 +72,15 @@
   };
 
   // The linked list of thread-local destructors to run
-  __thread DtorList* dtors = nullptr;
+#ifndef __MVS__
+  __thread
+#endif
+  DtorList* dtors = nullptr;
   // True if the destructors are currently scheduled to run on this thread
-  __thread bool dtors_alive = false;
+#ifndef __MVS__
+  __thread
+#endif
+  bool dtors_alive = false;
   // Used to trigger destructors on thread exit; value is ignored
   std::__libcpp_tls_key dtors_key;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135464.466111.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221007/e970fb4c/attachment.bin>


More information about the libcxx-commits mailing list