[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
Tue Nov 30 12:24:42 PST 2021


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

formalize `LLVM_EXTERNAL_UNWIND_SOURCE_DIR` definition in libcxxabi/CMakeLists.txt


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

https://reviews.llvm.org/D99913

Files:
  libcxx/cmake/caches/zos.cmake
  libcxxabi/CMakeLists.txt
  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: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -130,6 +130,8 @@
 result in the library being named libc++abi.x.y.dylib, along with the \
 usual symlinks pointing to that.")
 
+set(LLVM_EXTERNAL_UNWIND_SOURCE_DIR "" CACHE PATH "The path to the external unwind source directory.")
+
 # Default to building a shared library so that the default options still test
 # the libc++abi that is being built. There are two problems with testing a
 # static libc++abi. In the case of a standalone build, the tests will link the
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 "The path to the external unwind source directory.")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99913.390781.patch
Type: text/x-patch
Size: 2645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211130/22282b0c/attachment.bin>


More information about the libcxx-commits mailing list