[libcxx-commits] [PATCH] D99913: [SystemZ][z/OS] Modify cxxabi to be compatible with existing z/OS runtime

Muiez Ahmed via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 16 13:57:41 PDT 2022


muiez updated this revision to Diff 437697.
muiez edited the summary of this revision.
muiez set the repository for this revision to rG LLVM Github Monorepo.
muiez added a comment.
Herald added a subscriber: StephenFan.
Herald added a project: All.

Removed logic for using an external unwinder. A subsequent patch will add support for building/linking an external unwinder in a non-ad hoc way.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99913/new/

https://reviews.llvm.org/D99913

Files:
  libcxxabi/src/cxa_exception.cpp
  libcxxabi/src/cxa_personality.cpp


Index: libcxxabi/src/cxa_personality.cpp
===================================================================
--- libcxxabi/src/cxa_personality.cpp
+++ libcxxabi/src/cxa_personality.cpp
@@ -622,7 +622,7 @@
         results.reason = _URC_FATAL_PHASE1_ERROR;
         return;
     }
-    // Start scan by getting exception table address
+    // Start scan by getting exception table address.
     const uint8_t *lsda = (const uint8_t *)_Unwind_GetLanguageSpecificData(context);
     if (lsda == 0)
     {
@@ -912,6 +912,8 @@
 _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code
 #ifdef __USING_SJLJ_EXCEPTIONS__
 __gxx_personality_sj0
+#elif defined(__MVS__)
+__zos_cxx_personality_v2
 #else
 __gxx_personality_v0
 #endif
@@ -1121,7 +1123,7 @@
         }
 
         // Either we didn't do a phase 1 search (due to forced unwinding), or
-        //  phase 1 reported no catching-handlers.
+        // phase 1 reported no catching-handlers.
         // Search for a (non-catching) cleanup
         if (is_force_unwinding)
           scan_eh_tab(
Index: libcxxabi/src/cxa_exception.cpp
===================================================================
--- libcxxabi/src/cxa_exception.cpp
+++ libcxxabi/src/cxa_exception.cpp
@@ -444,6 +444,14 @@
             (
                 static_cast<_Unwind_Exception*>(unwind_exception)
             );
+
+#if defined(__MVS__)
+    // Remove the exception object from the linked list of exceptions that the z/OS unwinder
+    // maintains before adding it to the libc++abi list of caught exceptions.
+    // The libc++abi will manage the lifetime of the exception from this point forward.
+    _UnwindZOS_PopException();
+#endif
+
     if (native_exception)
     {
         // Increment the handler count, removing the flag about being rethrown


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99913.437697.patch
Type: text/x-patch
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220616/ce01ce77/attachment.bin>


More information about the libcxx-commits mailing list