diff --git a/libcxx/cmake/Modules/HandleExceptionLibrary.cmake b/libcxx/cmake/Modules/HandleExceptionLibrary.cmake
new file mode 100644
--- /dev/null
+++ b/libcxx/cmake/Modules/HandleExceptionLibrary.cmake
@@ -0,0 +1,39 @@
+#===============================================================================
+# Define targets for linking against the selected ABI library
+#
+# After including this file, the following targets are defined:
+# - cxx_exception: A target representing the shared c++_exception library.
+#                  constituting the split from c++ shared library.
+#                  The LIBCXX_EXCEPTION_ZOS_BUILD, which can be defined in
+#                  cache, determines if the library will be built or not.
+#===============================================================================
+
+
+if (LIBCXX_EXCEPTION_ZOS_BUILD)
+	add_library(cxx_exception SHARED ${exclude_from_all} ${LIBCXX_EXCEPTIONS_SOURCE} ${LIBCXX_HEADERS})
+  target_link_libraries(cxx_exception PUBLIC cxx-headers
+                                      PRIVATE ${LIBCXX_LIBRARIES})
+  set_target_properties(cxx_exception
+    PROPERTIES
+      COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
+      LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"
+      OUTPUT_NAME   "c++_exception"
+      VERSION       "${LIBCXX_ABI_VERSION}"
+      SOVERSION     "${LIBCXX_ABI_VERSION}"
+      DEFINE_SYMBOL ""
+      POSITION_INDEPENDENT_CODE ON
+  )
+  cxx_add_common_build_flags(cxx_exception)
+  cxx_set_common_defines(cxx_exception)
+
+  add_custom_command(TARGET cxx_exception POST_BUILD
+    COMMAND
+      ${LIBCXX_SOURCE_DIR}/utils/zos_rename_dll_side_deck.sh
+      $<TARGET_LINKER_FILE_NAME:cxx_exception> $<TARGET_FILE_NAME:cxx_exception> "${LIBCXX_EXCEPTION_DLL_NAME}"
+    COMMENT "Rename dll name inside the side deck file"
+    WORKING_DIRECTORY $<TARGET_FILE_DIR:cxx_exception>
+  )
+
+  target_link_libraries(cxx_exception PUBLIC libcxx-abi-shared)
+  list(APPEND LIBCXX_BUILD_TARGETS "cxx_exception")
+endif()
diff --git a/libcxx/cmake/caches/s390x-ibm-zos-ascii.cmake b/libcxx/cmake/caches/s390x-ibm-zos-ascii.cmake
--- a/libcxx/cmake/caches/s390x-ibm-zos-ascii.cmake
+++ b/libcxx/cmake/caches/s390x-ibm-zos-ascii.cmake
@@ -16,6 +16,8 @@
 set(LIBCXX_DLL_NAME CRTEQCXS CACHE STRING "")
 set(LIBCXX_SHARED_OUTPUT_NAME "c++_a" CACHE STRING
     "Output name for the shared libc++ runtime library.")
+set(LIBCXX_EXCEPTION_ZOS_BUILD OFF CACHE BOOL
+    "Build libcxx exception library on z/OS as standalone.")
 set(LIBCXX_CXX_ABI system-libcxxabi CACHE STRING "")
 
 set(LIBCXX_ADDITIONAL_COMPILE_FLAGS "-fzos-le-char-mode=ascii" CACHE STRING "")
diff --git a/libcxx/cmake/caches/s390x-ibm-zos.cmake b/libcxx/cmake/caches/s390x-ibm-zos.cmake
--- a/libcxx/cmake/caches/s390x-ibm-zos.cmake
+++ b/libcxx/cmake/caches/s390x-ibm-zos.cmake
@@ -12,6 +12,9 @@
 
 # Target Specific
 set(LIBCXX_DLL_NAME CRTEQCXE CACHE STRING "")
+set(LIBCXX_EXCEPTION_DLL_NAME CRTEQCXP CACHE STRING "")
+set(LIBCXX_EXCEPTION_ZOS_BUILD ON CACHE BOOL
+	    "Build libcxx exception library on z/OS as standalone.")
 
 set(LIBCXXABI_DLL_NAME CRTEQCXA CACHE STRING "")
 set(LIBCXXABI_ADDITIONAL_LIBRARIES "-Wl,lib/libunwind.x" CACHE STRING "")
diff --git a/libcxx/cmake/caches/s390x32-ibm-zos-ascii.cmake b/libcxx/cmake/caches/s390x32-ibm-zos-ascii.cmake
--- a/libcxx/cmake/caches/s390x32-ibm-zos-ascii.cmake
+++ b/libcxx/cmake/caches/s390x32-ibm-zos-ascii.cmake
@@ -16,6 +16,8 @@
 set(LIBCXX_DLL_NAME CRTEHCXS CACHE STRING "")
 set(LIBCXX_SHARED_OUTPUT_NAME "c++_a" CACHE STRING
     "Output name for the shared libc++ runtime library.")
+set(LIBCXX_EXCEPTION_ZOS_BUILD OFF CACHE BOOL
+    "Build libcxx exception library on z/OS as standalone.")
 set(LIBCXX_CXX_ABI system-libcxxabi CACHE STRING "")
 
 set(LIBCXX_ADDITIONAL_COMPILE_FLAGS "-fzos-le-char-mode=ascii" CACHE STRING "")
diff --git a/libcxx/cmake/caches/s390x32-ibm-zos.cmake b/libcxx/cmake/caches/s390x32-ibm-zos.cmake
--- a/libcxx/cmake/caches/s390x32-ibm-zos.cmake
+++ b/libcxx/cmake/caches/s390x32-ibm-zos.cmake
@@ -12,6 +12,9 @@
 
 # Target Specific
 set(LIBCXX_DLL_NAME CRTEHCXE CACHE STRING "")
+set(LIBCXX_EXCEPTION_DLL_NAME CRTEHCXP CACHE STRING "")
+set(LIBCXX_EXCEPTION_ZOS_BUILD ON CACHE BOOL
+    "Build libcxx exception library on z/OS as standalone.")
 
 set(LIBCXXABI_DLL_NAME CRTEHCXA CACHE STRING "")
 
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -47,6 +47,24 @@
 #  pragma GCC system_header
 #endif
 
+namespace std {
+#else
+_LIBCPP_BEGIN_NAMESPACE_STD
+#endif
+class _LIBCPP_EXCEPTION_ABI bad_weak_ptr : public std::exception {
+public:
+  bad_weak_ptr() _NOEXCEPT                    = default;
+  bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
+  ~bad_weak_ptr() _NOEXCEPT override;
+  const char* what() const _NOEXCEPT override;
+};
+
+#if defined(__MVS__)
+}
+#else
+_LIBCPP_END_NAMESPACE_STD
+#endif
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 // NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
@@ -106,16 +124,6 @@
 #endif
 }
 
-class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
-    : public std::exception
-{
-public:
-    bad_weak_ptr() _NOEXCEPT = default;
-    bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default;
-    ~bad_weak_ptr() _NOEXCEPT override;
-    const char* what() const  _NOEXCEPT override;
-};
-
 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
 void __throw_bad_weak_ptr()
 {
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -60,7 +60,6 @@
   typeinfo.cpp
   utility.cpp
   valarray.cpp
-  variant.cpp
   vector.cpp
   verbose_abort.cpp
   )
@@ -133,6 +132,14 @@
   endif()
 endif()
 
+set(LIBCXX_EXCEPTIONS_SOURCE
+  exceptions.cpp
+  )
+
+if (NOT ZOS)
+  list(APPEND LIBCXX_SOURCES ${LIBCXX_EXCEPTIONS_SOURCE})
+endif()
+
 # Add all the headers to the project for IDEs.
 if (LIBCXX_CONFIGURE_IDE)
   file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*)
@@ -287,6 +294,8 @@
   endif()
 endif()
 
+include(HandleExceptionLibrary)
+
 set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
 
 # Build the static library.
diff --git a/libcxx/src/any.cpp b/libcxx/src/any.cpp
--- a/libcxx/src/any.cpp
+++ b/libcxx/src/any.cpp
@@ -8,13 +8,6 @@
 
 #include <any>
 
-namespace std {
-const char* bad_any_cast::what() const noexcept {
-    return "bad any cast";
-}
-}
-
-
 #include <experimental/__config>
 
 //  Preserve std::experimental::any_bad_cast for ABI compatibility
diff --git a/libcxx/src/exceptions.cpp b/libcxx/src/exceptions.cpp
new file mode 100644
--- /dev/null
+++ b/libcxx/src/exceptions.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+#include <any>
+#include <memory>
+#include <optional>
+#include <variant>
+
+#if defined(__MVS__)
+namespace std {
+#else
+_LIBCPP_BEGIN_NAMESPACE_STD
+#endif
+bad_weak_ptr::~bad_weak_ptr() noexcept {}
+
+const char* bad_weak_ptr::what() const noexcept { return "bad_weak_ptr"; }
+#if defined(__MVS__)
+}
+#else
+_LIBCPP_END_NAMESPACE_STD
+#endif
+
+namespace std {
+const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
+
+bad_optional_access::~bad_optional_access() noexcept = default;
+const char* bad_optional_access::what() const noexcept { return "bad_optional_access"; }
+
+const char* bad_variant_access::what() const noexcept { return "bad_variant_access"; }
+} // namespace std
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -27,14 +27,6 @@
 
 const allocator_arg_t allocator_arg = allocator_arg_t();
 
-bad_weak_ptr::~bad_weak_ptr() noexcept {}
-
-const char*
-bad_weak_ptr::what() const noexcept
-{
-    return "bad_weak_ptr";
-}
-
 __shared_count::~__shared_count()
 {
 }
diff --git a/libcxx/src/optional.cpp b/libcxx/src/optional.cpp
--- a/libcxx/src/optional.cpp
+++ b/libcxx/src/optional.cpp
@@ -9,18 +9,6 @@
 #include <__availability>
 #include <optional>
 
-namespace std
-{
-
-bad_optional_access::~bad_optional_access() noexcept = default;
-
-const char* bad_optional_access::what() const noexcept {
-  return "bad_optional_access";
-}
-
-} // std
-
-
 #include <experimental/__config>
 
 //  Preserve std::experimental::bad_optional_access for ABI compatibility
diff --git a/libcxx/src/variant.cpp b/libcxx/src/variant.cpp
deleted file mode 100644
--- a/libcxx/src/variant.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <variant>
-
-namespace std {
-
-const char* bad_variant_access::what() const noexcept {
-  return "bad_variant_access";
-}
-
-}  // namespace std