[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
Wed Nov 24 14:04:09 PST 2021


muiez updated this revision to Diff 389610.
muiez added a comment.

definition of LLVM_EXTERNAL_UNWIND_SOURCE_DIR added


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

https://reviews.llvm.org/D99913

Files:
  libcxx/cmake/caches/zOS.cmake
  libcxxabi/src/CMakeLists.txt
  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
@@ -613,7 +613,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)
     {
@@ -903,6 +903,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
Index: libcxxabi/src/cxa_exception.cpp
===================================================================
--- libcxxabi/src/cxa_exception.cpp
+++ libcxxabi/src/cxa_exception.cpp
@@ -436,6 +436,11 @@
             (
                 static_cast<_Unwind_Exception*>(unwind_exception)
             );
+
+#if defined(__MVS__)
+    _UnwindZOS_PopException();
+#endif
+
     if (native_exception)
     {
         // Increment the handler count, removing the flag about being rethrown
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -47,6 +47,13 @@
   ../include/cxxabi.h
 )
 
+if (ZOS)
+  list(APPEND LIBCXXABI_HEADERS
+    ${LLVM_EXTERNAL_UNWIND_SOURCE_DIR}/unwind.h
+  )
+  include_directories("${LLVM_EXTERNAL_UNWIND_SOURCE_DIR}")
+endif()
+
 # Add all the headers to the project for IDEs.
 if (MSVC_IDE OR XCODE)
   # Force them all into the headers dir on MSVC, otherwise they end up at
Index: libcxx/cmake/caches/zOS.cmake
===================================================================
--- /dev/null
+++ libcxx/cmake/caches/zOS.cmake
@@ -0,0 +1 @@
+set(LLVM_EXTERNAL_UNWIND_SOURCE_DIR "$ENV{LLVM_BASE}/zos-unwind" CACHE PATH "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99913.389610.patch
Type: text/x-patch
Size: 1966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211124/4407649b/attachment.bin>


More information about the libcxx-commits mailing list