summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <dmoody256@gmail.com>2022-03-29 15:23:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-31 15:14:43 +0000
commitcd3770bc652d6c54368389f54e09dc381f9ea57e (patch)
treee6d7203ef93ec376a6ce59264819ef385dce3b02
parent89f8362eb1cf683296df7916992d28afbb81914d (diff)
downloadmongo-cd3770bc652d6c54368389f54e09dc381f9ea57e.tar.gz
SERVER-64440 added ppc and s390x libunwind support
-rw-r--r--SConstruct3
-rw-r--r--src/third_party/unwind/SConscript94
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/build/include/config.h247
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind-common.h292
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind.h40
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/build/include/stamp-h11
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/build/include/tdep/libunwind_i.h41
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-common.h292
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-dynamic.h215
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-ppc64.h271
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind.h40
-rw-r--r--src/third_party/unwind/platform/linux_ppc64le/install/include/unwind.h155
-rw-r--r--src/third_party/unwind/platform/linux_s390x/build/include/config.h247
-rw-r--r--src/third_party/unwind/platform/linux_s390x/build/include/libunwind-common.h292
-rw-r--r--src/third_party/unwind/platform/linux_s390x/build/include/libunwind.h40
-rw-r--r--src/third_party/unwind/platform/linux_s390x/build/include/stamp-h11
-rw-r--r--src/third_party/unwind/platform/linux_s390x/build/include/tdep/libunwind_i.h41
-rw-r--r--src/third_party/unwind/platform/linux_s390x/install/include/libunwind-common.h292
-rw-r--r--src/third_party/unwind/platform/linux_s390x/install/include/libunwind-dynamic.h215
-rw-r--r--src/third_party/unwind/platform/linux_s390x/install/include/libunwind-s390x.h144
-rw-r--r--src/third_party/unwind/platform/linux_s390x/install/include/libunwind.h40
-rw-r--r--src/third_party/unwind/platform/linux_s390x/install/include/unwind.h155
22 files changed, 3126 insertions, 32 deletions
diff --git a/SConstruct b/SConstruct
index 534b67216ce..e9815de0358 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1575,9 +1575,8 @@ use_libunwind = get_option("use-libunwind")
use_system_libunwind = use_system_version_of_library("libunwind")
# Assume system libunwind works if it's installed and selected.
-# Vendored libunwind, however, works only on linux-x86_64.
can_use_libunwind = (use_system_libunwind or
- env.TargetOSIs('linux') and (env['TARGET_ARCH'] == 'x86_64' or env['TARGET_ARCH'] == 'aarch64'))
+ env.TargetOSIs('linux') and (env['TARGET_ARCH'] in ('x86_64', 'aarch64', 'ppc64le', 's390x')))
if use_libunwind == "off":
use_libunwind = False
diff --git a/src/third_party/unwind/SConscript b/src/third_party/unwind/SConscript
index 1554698232a..643ae2c86bd 100644
--- a/src/third_party/unwind/SConscript
+++ b/src/third_party/unwind/SConscript
@@ -15,7 +15,7 @@ Import("debugBuild")
env = env.Clone(
# Libunwind wants to interpose (for better or for worse) on the
- # libc `backtrace`. Buidling with hidden visibility probably
+ # libc `backtrace`. Building with hidden visibility probably
# breaks that. It also seems to interfere with building with the
# sanitizers, which use linker maps that reference backtrace. This
# may be an ld.gold bug.
@@ -26,6 +26,13 @@ unwind_root = env.Dir(".").srcnode()
unwind_platform = unwind_root.Dir("platform/${TARGET_OS}_${TARGET_ARCH}")
unwind_src_dir = env.Dir("dist/src")
+if env['TARGET_ARCH'] == 'ppc64le':
+ env['UNWIND_TARGET_ARCH'] = 'ppc64'
+ env['UNWIND_TARGET_ARCH_ALT'] = 'ppc'
+else:
+ env['UNWIND_TARGET_ARCH'] = env['TARGET_ARCH']
+ env['UNWIND_TARGET_ARCH_ALT'] = env['TARGET_ARCH']
+
# Generated by a manual process:
# - Run "scripts/host_config.sh |tee host_config.out".
# - Gather .o dependencies of the libunwind.a target.
@@ -35,7 +42,7 @@ unwind_src_dir = env.Dir("dist/src")
# - Replace each .o with the source file (.c or .S) that generated it.
# - Ensure the the ${CC} arguments are preserved by SCons.
# Note you can skip NDEBUG defines as those should be inherited.
-unwind_sources = [
+unwind_common_sources = [
'dwarf/global.c',
'dwarf/Lexpr.c',
'dwarf/Lfde.c',
@@ -43,6 +50,7 @@ unwind_sources = [
'dwarf/Lfind_unwind_table.c',
'dwarf/Lparser.c',
'dwarf/Lpe.c',
+ "dl-iterate-phdr.c",
'elf64.c',
'mi/backtrace.c',
'mi/dyn-cancel.c',
@@ -66,35 +74,53 @@ unwind_sources = [
'mi/mempool.c',
'mi/strerror.c',
'os-${TARGET_OS}.c',
- '${TARGET_ARCH}/getcontext.S',
- '${TARGET_ARCH}/is_fpreg.c',
- '${TARGET_ARCH}/Lapply_reg_state.c',
- '${TARGET_ARCH}/Lcreate_addr_space.c',
- '${TARGET_ARCH}/Lget_proc_info.c',
- '${TARGET_ARCH}/Lget_save_loc.c',
- '${TARGET_ARCH}/Lglobal.c',
- '${TARGET_ARCH}/Linit.c',
- '${TARGET_ARCH}/Linit_local.c',
- '${TARGET_ARCH}/Linit_remote.c',
- '${TARGET_ARCH}/Lregs.c',
- '${TARGET_ARCH}/Lreg_states_iterate.c',
- '${TARGET_ARCH}/Lresume.c',
- '${TARGET_ARCH}/Lstash_frame.c',
- '${TARGET_ARCH}/Lstep.c',
- '${TARGET_ARCH}/Ltrace.c',
- '${TARGET_ARCH}/regname.c',
]
-if env['TARGET_ARCH'] == 'x86_64':
- unwind_sources.extend([
- '${TARGET_ARCH}/setcontext.S',
- '${TARGET_ARCH}/Los-${TARGET_OS}.c',
- ])
+unwind_platform_sources = [
+ '${UNWIND_TARGET_ARCH}/is_fpreg.c',
+ '${UNWIND_TARGET_ARCH}/Lapply_reg_state.c',
+ '${UNWIND_TARGET_ARCH}/Lcreate_addr_space.c',
+ '${UNWIND_TARGET_ARCH_ALT}/Lget_proc_info.c',
+ '${UNWIND_TARGET_ARCH_ALT}/Lget_save_loc.c',
+ '${UNWIND_TARGET_ARCH}/Lglobal.c',
+ '${UNWIND_TARGET_ARCH}/Linit.c',
+ '${UNWIND_TARGET_ARCH_ALT}/Linit_local.c',
+ '${UNWIND_TARGET_ARCH_ALT}/Linit_remote.c',
+ '${UNWIND_TARGET_ARCH}/Lregs.c',
+ '${UNWIND_TARGET_ARCH}/Lreg_states_iterate.c',
+ '${UNWIND_TARGET_ARCH}/Lresume.c',
+ '${UNWIND_TARGET_ARCH}/Lstep.c',
+ '${UNWIND_TARGET_ARCH}/regname.c',
+]
-if env['TARGET_ARCH'] == 'aarch64':
- unwind_sources.extend([
- '${TARGET_ARCH}/Lis_signal_frame.c',
- ])
+if env['TARGET_ARCH'] == 'x86_64':
+ unwind_platform_sources += [
+ "${UNWIND_TARGET_ARCH}/Los-${TARGET_OS}.c",
+ '${UNWIND_TARGET_ARCH}/Lstash_frame.c',
+ '${UNWIND_TARGET_ARCH}/Ltrace.c',
+ "${UNWIND_TARGET_ARCH}/getcontext.S",
+ "${UNWIND_TARGET_ARCH}/setcontext.S",
+ ]
+elif env['TARGET_ARCH'] == 'aarch64':
+ unwind_platform_sources += [
+ "${UNWIND_TARGET_ARCH}/Lis_signal_frame.c",
+ "${UNWIND_TARGET_ARCH}/Lstash_frame.c",
+ "${UNWIND_TARGET_ARCH}/Ltrace.c",
+ "${UNWIND_TARGET_ARCH}/getcontext.S",
+ ]
+elif env['TARGET_ARCH'] == 'ppc64le':
+ unwind_platform_sources += [
+ "${UNWIND_TARGET_ARCH}/get_func_addr.c",
+ "${UNWIND_TARGET_ARCH_ALT}/Lis_signal_frame.c",
+ ]
+elif env['TARGET_ARCH'] == 's390x':
+ unwind_platform_sources += [
+ "${UNWIND_TARGET_ARCH}/Lis_signal_frame.c",
+ "${UNWIND_TARGET_ARCH}/getcontext.S",
+ "${UNWIND_TARGET_ARCH}/setcontext.S",
+ ]
+else:
+ env.FatalError(f"{env['TARGET_ARCH']} unsupported by libunwind.")
env.Append(
CCFLAGS=[
@@ -105,6 +131,12 @@ env.Append(
'-Wno-unused-variable',
])
+if env['TARGET_ARCH'] == 'ppc64le':
+ env.Append(
+ CCFLAGS=[
+ '-Wno-unused-value'
+ ])
+
if env.ToolchainIs('clang'):
env.Append(CCFLAGS=['-Wno-header-guard'])
@@ -113,10 +145,10 @@ env.Append(
unwind_platform.Dir("build/include"),
unwind_root.Dir("dist/src"),
unwind_root.Dir("dist/include"),
- unwind_root.Dir("dist/include/tdep-${TARGET_ARCH}"),
+ unwind_root.Dir("dist/include/tdep-${UNWIND_TARGET_ARCH}"),
])
-# propagates to consumers that Inject (depend on) unwind.
+# propagates to consumers that inject (depend on) unwind.
env.RegisterConsumerModifications(
CPPPATH=[unwind_platform.Dir("install/include")],
SYSLIBDEPS_PRIVATE=[env['LIBDEPS_LZMA_SYSLIBDEP']])
@@ -130,6 +162,8 @@ env.Append(
'_GNU_SOURCE',
])
+unwind_sources = unwind_common_sources + unwind_platform_sources
+
env.Library(
target='unwind',
source=env.File(unwind_sources, unwind_src_dir),
diff --git a/src/third_party/unwind/platform/linux_ppc64le/build/include/config.h b/src/third_party/unwind/platform/linux_ppc64le/build/include/config.h
new file mode 100644
index 00000000000..77f6db636fb
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/build/include/config.h
@@ -0,0 +1,247 @@
+/* include/config.h. Generated from config.h.in by configure. */
+/* include/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Block signals before mutex operations */
+#define CONFIG_BLOCK_SIGNALS /**/
+
+/* Enable Debug Frame */
+/* #undef CONFIG_DEBUG_FRAME */
+
+/* Support for Microsoft ABI extensions */
+/* #undef CONFIG_MSABI_SUPPORT */
+
+/* Define if the weak 'backtrace' symbol is provided. */
+#define CONFIG_WEAK_BACKTRACE 1
+
+/* Define to 1 if you want every memory access validated */
+#define CONSERVATIVE_CHECKS 1
+
+/* Define to 1 if you have the <asm/ptrace.h> header file. */
+#define HAVE_ASM_PTRACE_H 1
+
+/* Define to 1 if you have the <asm/ptrace_offsets.h> header file. */
+/* #undef HAVE_ASM_PTRACE_OFFSETS_H */
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+#define HAVE_BYTESWAP_H 1
+
+/* Define to 1 if you have the declaration of `PTRACE_CONT', and to 0 if you
+ don't. */
+#define HAVE_DECL_PTRACE_CONT 1
+
+/* Define to 1 if you have the declaration of `PTRACE_POKEDATA', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_POKEDATA 1
+
+/* Define to 1 if you have the declaration of `PTRACE_POKEUSER', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_POKEUSER 1
+
+/* Define to 1 if you have the declaration of `PTRACE_SETREGSET', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_SETREGSET 1
+
+/* Define to 1 if you have the declaration of `PTRACE_SINGLESTEP', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_SINGLESTEP 1
+
+/* Define to 1 if you have the declaration of `PTRACE_SYSCALL', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_SYSCALL 1
+
+/* Define to 1 if you have the declaration of `PTRACE_TRACEME', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_TRACEME 1
+
+/* Define to 1 if you have the declaration of `PT_CONTINUE', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_CONTINUE 1
+
+/* Define to 1 if you have the declaration of `PT_GETFPREGS', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_GETFPREGS 0
+
+/* Define to 1 if you have the declaration of `PT_GETREGS', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_GETREGS 0
+
+/* Define to 1 if you have the declaration of `PT_IO', and to 0 if you don't.
+ */
+#define HAVE_DECL_PT_IO 0
+
+/* Define to 1 if you have the declaration of `PT_STEP', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_STEP 1
+
+/* Define to 1 if you have the declaration of `PT_SYSCALL', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_SYSCALL 1
+
+/* Define to 1 if you have the declaration of `PT_TRACE_ME', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_TRACE_ME 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlmodinfo' function. */
+/* #undef HAVE_DLMODINFO */
+
+/* Define to 1 if you have the `dl_iterate_phdr' function. */
+#define HAVE_DL_ITERATE_PHDR 1
+
+/* Define to 1 if you have the `dl_phdr_removals_counter' function. */
+/* #undef HAVE_DL_PHDR_REMOVALS_COUNTER */
+
+/* Define to 1 if you have the <elf.h> header file. */
+#define HAVE_ELF_H 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define HAVE_ENDIAN_H 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#define HAVE_EXECINFO_H 1
+
+/* Define to 1 if you have the `getunwind' function. */
+/* #undef HAVE_GETUNWIND */
+
+/* Define to 1 if you have the <ia64intrin.h> header file. */
+/* #undef HAVE_IA64INTRIN_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `uca' library (-luca). */
+/* #undef HAVE_LIBUCA */
+
+/* Define to 1 if you have the <link.h> header file. */
+#define HAVE_LINK_H 1
+
+/* Define if you have liblzma */
+/* #undef HAVE_LZMA */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mincore' function. */
+#define HAVE_MINCORE 1
+
+/* Define to 1 if you have the `pipe2' function. */
+#define HAVE_PIPE2 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if `dlpi_subs' is a member of `struct dl_phdr_info'. */
+#define HAVE_STRUCT_DL_PHDR_INFO_DLPI_SUBS 1
+
+/* Define to 1 if the system has the type `struct elf_prstatus'. */
+#define HAVE_STRUCT_ELF_PRSTATUS 1
+
+/* Define to 1 if the system has the type `struct prstatus'. */
+/* #undef HAVE_STRUCT_PRSTATUS */
+
+/* Define to 1 if you have the <sys/elf.h> header file. */
+/* #undef HAVE_SYS_ELF_H */
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+/* #undef HAVE_SYS_ENDIAN_H */
+
+/* Define to 1 if you have the <sys/link.h> header file. */
+/* #undef HAVE_SYS_LINK_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/procfs.h> header file. */
+#define HAVE_SYS_PROCFS_H 1
+
+/* Define to 1 if you have the <sys/ptrace.h> header file. */
+#define HAVE_SYS_PTRACE_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uc_access.h> header file. */
+/* #undef HAVE_SYS_UC_ACCESS_H */
+
+/* Define to 1 if you have the `ttrace' function. */
+/* #undef HAVE_TTRACE */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have libz */
+/* #undef HAVE_ZLIB */
+
+/* Defined if __builtin_unreachable() is available */
+#define HAVE__BUILTIN_UNREACHABLE 1
+
+/* Defined if __builtin___clear_cache() is available */
+#define HAVE__BUILTIN___CLEAR_CACHE 1
+
+/* Define to 1 if --enable-per-thread-cache */
+/* #undef HAVE___CACHE_PER_THREAD */
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libunwind"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "libunwind-devel@nongnu.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libunwind"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libunwind 1.6.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libunwind"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.6.2"
+
+/* The size of `off_t', as computed by sizeof. */
+#define SIZEOF_OFF_T 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.6.2"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind-common.h b/src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind-common.h
new file mode 100644
index 00000000000..9de37c1d7c0
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind-common.h
@@ -0,0 +1,292 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_VERSION_MAJOR 1
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
+
+#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
+#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
+
+#ifdef __sun
+// On SmartOS, gcc fails with the following error:
+//
+// ../include/libunwind-common.h:43:41: error: expected identifier or '(' before numeric constant
+// # define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+// ^
+//
+// workaround is to undefine _U explicitly.
+// see https://github.com/libunwind/libunwind/issues/118 for more details.
+//
+#undef _U
+#endif
+
+#define UNW_PASTE2(x,y) x##y
+#define UNW_PASTE(x,y) UNW_PASTE2(x,y)
+#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn)
+#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn)
+
+#ifdef UNW_LOCAL_ONLY
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_)
+#else /* !UNW_LOCAL_ONLY */
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+#endif /* !UNW_LOCAL_ONLY */
+
+/* Error codes. The unwind routines return the *negated* values of
+ these error codes on error and a non-negative value on success. */
+typedef enum
+ {
+ UNW_ESUCCESS = 0, /* no error */
+ UNW_EUNSPEC, /* unspecified (general) error */
+ UNW_ENOMEM, /* out of memory */
+ UNW_EBADREG, /* bad register number */
+ UNW_EREADONLYREG, /* attempt to write read-only register */
+ UNW_ESTOPUNWIND, /* stop unwinding */
+ UNW_EINVALIDIP, /* invalid IP */
+ UNW_EBADFRAME, /* bad frame */
+ UNW_EINVAL, /* unsupported operation or bad value */
+ UNW_EBADVERSION, /* unwind info has unsupported version */
+ UNW_ENOINFO /* no unwind info found */
+ }
+unw_error_t;
+
+/* The following enum defines the indices for a couple of
+ (pseudo-)registers which have the same meaning across all
+ platforms. (RO) means read-only. (RW) means read-write. General
+ registers (aka "integer registers") are expected to start with
+ index 0. The number of such registers is architecture-dependent.
+ The remaining indices can be used as an architecture sees fit. The
+ last valid register index is given by UNW_REG_LAST. */
+typedef enum
+ {
+ UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */
+ UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */
+ UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */
+ UNW_REG_LAST = UNW_TDEP_LAST_REG
+ }
+unw_frame_regnum_t;
+
+/* Number of exception-handler argument registers: */
+#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS
+
+typedef enum
+ {
+ UNW_CACHE_NONE, /* no caching */
+ UNW_CACHE_GLOBAL, /* shared global cache */
+ UNW_CACHE_PER_THREAD /* per-thread caching */
+ }
+unw_caching_policy_t;
+
+typedef enum
+ {
+ UNW_INIT_SIGNAL_FRAME = 1, /* We know this is a signal frame */
+ }
+unw_init_local2_flags_t;
+
+typedef int unw_regnum_t;
+
+/* The unwind cursor starts at the youngest (most deeply nested) frame
+ and is used to track the frame state as the unwinder steps from
+ frame to frame. It is safe to make (shallow) copies of variables
+ of this type. */
+typedef struct unw_cursor
+ {
+ unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
+ }
+unw_cursor_t;
+
+/* This type encapsulates the entire (preserved) machine-state. */
+typedef unw_tdep_context_t unw_context_t;
+
+/* unw_getcontext() fills the unw_context_t pointed to by UC with the
+ machine state as it exists at the call-site. For implementation
+ reasons, this needs to be a target-dependent macro. It's easiest
+ to think of unw_getcontext() as being identical to getcontext(). */
+#define unw_getcontext(uc) unw_tdep_getcontext(uc)
+
+/* Return 1 if register number R is a floating-point register, zero
+ otherwise.
+ This routine is signal-safe. */
+#define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
+
+typedef unw_tdep_fpreg_t unw_fpreg_t;
+
+typedef struct unw_addr_space *unw_addr_space_t;
+
+/* Each target may define it's own set of flags, but bits 0-15 are
+ reserved for general libunwind-use. */
+#define UNW_PI_FLAG_FIRST_TDEP_BIT 16
+/* The information comes from a .debug_frame section. */
+#define UNW_PI_FLAG_DEBUG_FRAME 32
+
+typedef struct unw_proc_info
+ {
+ unw_word_t start_ip; /* first IP covered by this procedure */
+ unw_word_t end_ip; /* first IP NOT covered by this procedure */
+#if defined(NEED_LAST_IP)
+ unw_word_t last_ip; /* first IP that could begin another procedure */
+#endif
+ unw_word_t lsda; /* address of lang.-spec. data area (if any) */
+ unw_word_t handler; /* optional personality routine */
+ unw_word_t gp; /* global-pointer value for this procedure */
+ unw_word_t flags; /* misc. flags */
+
+ int format; /* unwind-info format (arch-specific) */
+ int unwind_info_size; /* size of the information (if applicable) */
+ void *unwind_info; /* unwind-info (arch-specific) */
+ unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */
+ }
+unw_proc_info_t;
+
+typedef int (*unw_reg_states_callback)(void *token,
+ void *reg_states_data,
+ size_t reg_states_data_size,
+ unw_word_t start_ip, unw_word_t end_ip);
+
+/* These are backend callback routines that provide access to the
+ state of a "remote" process. This can be used, for example, to
+ unwind another process through the ptrace() interface. */
+typedef struct unw_accessors
+ {
+ /* Look up the unwind info associated with instruction-pointer IP.
+ On success, the routine fills in the PROC_INFO structure. */
+ int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *,
+ int, void *);
+
+ /* Release any resources (e.g., memory) that were allocated for
+ the unwind info returned in by a previous call to
+ find_proc_info() with NEED_UNWIND_INFO set to 1. */
+ void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *);
+
+ /* Return the list-head of the dynamically registered unwind
+ info. */
+ int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *);
+
+ /* Access aligned word at address ADDR. The value is returned
+ according to the endianness of the host (e.g., if the host is
+ little-endian and the target is big-endian, access_mem() needs
+ to byte-swap the value before returning it). */
+ int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t,
+ unw_fpreg_t *, int, void *);
+
+ int (*resume) (unw_addr_space_t, unw_cursor_t *, void *);
+
+ /* Optional call back to obtain the name of a (static) procedure.
+ Dynamically generated procedures are handled automatically by
+ libunwind. This callback is optional and may be set to
+ NULL. */
+ int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+ }
+unw_accessors_t;
+
+typedef enum unw_save_loc_type
+ {
+ UNW_SLT_NONE, /* register is not saved ("not an l-value") */
+ UNW_SLT_MEMORY, /* register has been saved in memory */
+ UNW_SLT_REG /* register has been saved in (another) register */
+ }
+unw_save_loc_type_t;
+
+typedef struct unw_save_loc
+ {
+ unw_save_loc_type_t type;
+ union
+ {
+ unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */
+ unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */
+ }
+ u;
+ unw_tdep_save_loc_t extra; /* target-dependent additional information */
+ }
+unw_save_loc_t;
+
+/* These routines work both for local and remote unwinding. */
+
+#define unw_local_addr_space UNW_OBJ(local_addr_space)
+#define unw_create_addr_space UNW_OBJ(create_addr_space)
+#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space)
+#define unw_get_accessors UNW_ARCH_OBJ(get_accessors)
+#define unw_get_accessors_int UNW_ARCH_OBJ(get_accessors_int)
+#define unw_init_local UNW_OBJ(init_local)
+#define unw_init_local2 UNW_OBJ(init_local2)
+#define unw_init_remote UNW_OBJ(init_remote)
+#define unw_step UNW_OBJ(step)
+#define unw_resume UNW_OBJ(resume)
+#define unw_get_proc_info UNW_OBJ(get_proc_info)
+#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip)
+#define unw_reg_states_iterate UNW_OBJ(reg_states_iterate)
+#define unw_apply_reg_state UNW_OBJ(apply_reg_state)
+#define unw_get_reg UNW_OBJ(get_reg)
+#define unw_set_reg UNW_OBJ(set_reg)
+#define unw_get_fpreg UNW_OBJ(get_fpreg)
+#define unw_set_fpreg UNW_OBJ(set_fpreg)
+#define unw_get_save_loc UNW_OBJ(get_save_loc)
+#define unw_is_signal_frame UNW_OBJ(is_signal_frame)
+#define unw_get_proc_name UNW_OBJ(get_proc_name)
+#define unw_set_caching_policy UNW_OBJ(set_caching_policy)
+#define unw_set_cache_size UNW_OBJ(set_cache_size)
+#define unw_regname UNW_ARCH_OBJ(regname)
+#define unw_flush_cache UNW_ARCH_OBJ(flush_cache)
+#define unw_strerror UNW_ARCH_OBJ(strerror)
+
+extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int);
+extern void unw_destroy_addr_space (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors_int (unw_addr_space_t);
+extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t);
+extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t);
+extern int unw_set_cache_size (unw_addr_space_t, size_t, int);
+extern const char *unw_regname (unw_regnum_t);
+
+extern int unw_init_local (unw_cursor_t *, unw_context_t *);
+extern int unw_init_local2 (unw_cursor_t *, unw_context_t *, int);
+extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *);
+extern int unw_step (unw_cursor_t *);
+extern int unw_resume (unw_cursor_t *);
+extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *);
+extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, void *);
+extern int unw_reg_states_iterate (unw_cursor_t *, unw_reg_states_callback, void *);
+extern int unw_apply_reg_state (unw_cursor_t *, void *);
+extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *);
+extern int unw_set_reg (unw_cursor_t *, int, unw_word_t);
+extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *);
+extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t);
+extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *);
+extern int unw_is_signal_frame (unw_cursor_t *);
+extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *);
+extern const char *unw_strerror (int);
+extern int unw_backtrace (void **, int);
+
+extern unw_addr_space_t unw_local_addr_space;
diff --git a/src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind.h b/src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind.h
new file mode 100644
index 00000000000..23d0075615a
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/build/include/libunwind.h
@@ -0,0 +1,40 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+#include "libunwind-aarch64.h"
+#elif defined __arm__
+# include "libunwind-arm.h"
+#elif defined __hppa__
+# include "libunwind-hppa.h"
+#elif defined __ia64__
+# include "libunwind-ia64.h"
+#elif defined __mips__
+# include "libunwind-mips.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "libunwind-ppc32.h"
+#elif defined __powerpc64__
+# include "libunwind-ppc64.h"
+#elif defined __sh__
+# include "libunwind-sh.h"
+#elif defined __i386__
+# include "libunwind-x86.h"
+#elif defined __x86_64__
+# include "libunwind-x86_64.h"
+#elif defined __tilegx__
+# include "libunwind-tilegx.h"
+#elif defined __s390x__
+# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
+#else
+# error "Unsupported arch"
+#endif
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "libunwind-ppc64.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/platform/linux_ppc64le/build/include/stamp-h1 b/src/third_party/unwind/platform/linux_ppc64le/build/include/stamp-h1
new file mode 100644
index 00000000000..b330768e9bf
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/build/include/stamp-h1
@@ -0,0 +1 @@
+timestamp for include/config.h
diff --git a/src/third_party/unwind/platform/linux_ppc64le/build/include/tdep/libunwind_i.h b/src/third_party/unwind/platform/linux_ppc64le/build/include/tdep/libunwind_i.h
new file mode 100644
index 00000000000..a773be2cd93
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/build/include/tdep/libunwind_i.h
@@ -0,0 +1,41 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+# include "tdep-aarch64/libunwind_i.h"
+#elif defined __arm__
+# include "tdep-arm/libunwind_i.h"
+#elif defined __hppa__
+# include "tdep-hppa/libunwind_i.h"
+#elif defined __ia64__
+# include "tdep-ia64/libunwind_i.h"
+#elif defined __mips__
+# include "tdep-mips/libunwind_i.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "tdep-ppc32/libunwind_i.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/libunwind_i.h"
+#elif defined __sh__
+# include "tdep-sh/libunwind_i.h"
+#elif defined __i386__
+# include "tdep-x86/libunwind_i.h"
+#elif defined __x86_64__
+# include "tdep-x86_64/libunwind_i.h"
+#elif defined __tilegx__
+# include "tdep-tilegx/libunwind_i.h"
+#elif defined __s390x__
+# include "tdep-s390x/libunwind_i.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/libunwind_i.h"
+#else
+# error "Unsupported arch"
+#endif
+
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "tdep-ppc64/libunwind_i.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-common.h b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-common.h
new file mode 100644
index 00000000000..9de37c1d7c0
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-common.h
@@ -0,0 +1,292 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_VERSION_MAJOR 1
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
+
+#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
+#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
+
+#ifdef __sun
+// On SmartOS, gcc fails with the following error:
+//
+// ../include/libunwind-common.h:43:41: error: expected identifier or '(' before numeric constant
+// # define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+// ^
+//
+// workaround is to undefine _U explicitly.
+// see https://github.com/libunwind/libunwind/issues/118 for more details.
+//
+#undef _U
+#endif
+
+#define UNW_PASTE2(x,y) x##y
+#define UNW_PASTE(x,y) UNW_PASTE2(x,y)
+#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn)
+#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn)
+
+#ifdef UNW_LOCAL_ONLY
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_)
+#else /* !UNW_LOCAL_ONLY */
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+#endif /* !UNW_LOCAL_ONLY */
+
+/* Error codes. The unwind routines return the *negated* values of
+ these error codes on error and a non-negative value on success. */
+typedef enum
+ {
+ UNW_ESUCCESS = 0, /* no error */
+ UNW_EUNSPEC, /* unspecified (general) error */
+ UNW_ENOMEM, /* out of memory */
+ UNW_EBADREG, /* bad register number */
+ UNW_EREADONLYREG, /* attempt to write read-only register */
+ UNW_ESTOPUNWIND, /* stop unwinding */
+ UNW_EINVALIDIP, /* invalid IP */
+ UNW_EBADFRAME, /* bad frame */
+ UNW_EINVAL, /* unsupported operation or bad value */
+ UNW_EBADVERSION, /* unwind info has unsupported version */
+ UNW_ENOINFO /* no unwind info found */
+ }
+unw_error_t;
+
+/* The following enum defines the indices for a couple of
+ (pseudo-)registers which have the same meaning across all
+ platforms. (RO) means read-only. (RW) means read-write. General
+ registers (aka "integer registers") are expected to start with
+ index 0. The number of such registers is architecture-dependent.
+ The remaining indices can be used as an architecture sees fit. The
+ last valid register index is given by UNW_REG_LAST. */
+typedef enum
+ {
+ UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */
+ UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */
+ UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */
+ UNW_REG_LAST = UNW_TDEP_LAST_REG
+ }
+unw_frame_regnum_t;
+
+/* Number of exception-handler argument registers: */
+#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS
+
+typedef enum
+ {
+ UNW_CACHE_NONE, /* no caching */
+ UNW_CACHE_GLOBAL, /* shared global cache */
+ UNW_CACHE_PER_THREAD /* per-thread caching */
+ }
+unw_caching_policy_t;
+
+typedef enum
+ {
+ UNW_INIT_SIGNAL_FRAME = 1, /* We know this is a signal frame */
+ }
+unw_init_local2_flags_t;
+
+typedef int unw_regnum_t;
+
+/* The unwind cursor starts at the youngest (most deeply nested) frame
+ and is used to track the frame state as the unwinder steps from
+ frame to frame. It is safe to make (shallow) copies of variables
+ of this type. */
+typedef struct unw_cursor
+ {
+ unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
+ }
+unw_cursor_t;
+
+/* This type encapsulates the entire (preserved) machine-state. */
+typedef unw_tdep_context_t unw_context_t;
+
+/* unw_getcontext() fills the unw_context_t pointed to by UC with the
+ machine state as it exists at the call-site. For implementation
+ reasons, this needs to be a target-dependent macro. It's easiest
+ to think of unw_getcontext() as being identical to getcontext(). */
+#define unw_getcontext(uc) unw_tdep_getcontext(uc)
+
+/* Return 1 if register number R is a floating-point register, zero
+ otherwise.
+ This routine is signal-safe. */
+#define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
+
+typedef unw_tdep_fpreg_t unw_fpreg_t;
+
+typedef struct unw_addr_space *unw_addr_space_t;
+
+/* Each target may define it's own set of flags, but bits 0-15 are
+ reserved for general libunwind-use. */
+#define UNW_PI_FLAG_FIRST_TDEP_BIT 16
+/* The information comes from a .debug_frame section. */
+#define UNW_PI_FLAG_DEBUG_FRAME 32
+
+typedef struct unw_proc_info
+ {
+ unw_word_t start_ip; /* first IP covered by this procedure */
+ unw_word_t end_ip; /* first IP NOT covered by this procedure */
+#if defined(NEED_LAST_IP)
+ unw_word_t last_ip; /* first IP that could begin another procedure */
+#endif
+ unw_word_t lsda; /* address of lang.-spec. data area (if any) */
+ unw_word_t handler; /* optional personality routine */
+ unw_word_t gp; /* global-pointer value for this procedure */
+ unw_word_t flags; /* misc. flags */
+
+ int format; /* unwind-info format (arch-specific) */
+ int unwind_info_size; /* size of the information (if applicable) */
+ void *unwind_info; /* unwind-info (arch-specific) */
+ unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */
+ }
+unw_proc_info_t;
+
+typedef int (*unw_reg_states_callback)(void *token,
+ void *reg_states_data,
+ size_t reg_states_data_size,
+ unw_word_t start_ip, unw_word_t end_ip);
+
+/* These are backend callback routines that provide access to the
+ state of a "remote" process. This can be used, for example, to
+ unwind another process through the ptrace() interface. */
+typedef struct unw_accessors
+ {
+ /* Look up the unwind info associated with instruction-pointer IP.
+ On success, the routine fills in the PROC_INFO structure. */
+ int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *,
+ int, void *);
+
+ /* Release any resources (e.g., memory) that were allocated for
+ the unwind info returned in by a previous call to
+ find_proc_info() with NEED_UNWIND_INFO set to 1. */
+ void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *);
+
+ /* Return the list-head of the dynamically registered unwind
+ info. */
+ int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *);
+
+ /* Access aligned word at address ADDR. The value is returned
+ according to the endianness of the host (e.g., if the host is
+ little-endian and the target is big-endian, access_mem() needs
+ to byte-swap the value before returning it). */
+ int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t,
+ unw_fpreg_t *, int, void *);
+
+ int (*resume) (unw_addr_space_t, unw_cursor_t *, void *);
+
+ /* Optional call back to obtain the name of a (static) procedure.
+ Dynamically generated procedures are handled automatically by
+ libunwind. This callback is optional and may be set to
+ NULL. */
+ int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+ }
+unw_accessors_t;
+
+typedef enum unw_save_loc_type
+ {
+ UNW_SLT_NONE, /* register is not saved ("not an l-value") */
+ UNW_SLT_MEMORY, /* register has been saved in memory */
+ UNW_SLT_REG /* register has been saved in (another) register */
+ }
+unw_save_loc_type_t;
+
+typedef struct unw_save_loc
+ {
+ unw_save_loc_type_t type;
+ union
+ {
+ unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */
+ unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */
+ }
+ u;
+ unw_tdep_save_loc_t extra; /* target-dependent additional information */
+ }
+unw_save_loc_t;
+
+/* These routines work both for local and remote unwinding. */
+
+#define unw_local_addr_space UNW_OBJ(local_addr_space)
+#define unw_create_addr_space UNW_OBJ(create_addr_space)
+#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space)
+#define unw_get_accessors UNW_ARCH_OBJ(get_accessors)
+#define unw_get_accessors_int UNW_ARCH_OBJ(get_accessors_int)
+#define unw_init_local UNW_OBJ(init_local)
+#define unw_init_local2 UNW_OBJ(init_local2)
+#define unw_init_remote UNW_OBJ(init_remote)
+#define unw_step UNW_OBJ(step)
+#define unw_resume UNW_OBJ(resume)
+#define unw_get_proc_info UNW_OBJ(get_proc_info)
+#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip)
+#define unw_reg_states_iterate UNW_OBJ(reg_states_iterate)
+#define unw_apply_reg_state UNW_OBJ(apply_reg_state)
+#define unw_get_reg UNW_OBJ(get_reg)
+#define unw_set_reg UNW_OBJ(set_reg)
+#define unw_get_fpreg UNW_OBJ(get_fpreg)
+#define unw_set_fpreg UNW_OBJ(set_fpreg)
+#define unw_get_save_loc UNW_OBJ(get_save_loc)
+#define unw_is_signal_frame UNW_OBJ(is_signal_frame)
+#define unw_get_proc_name UNW_OBJ(get_proc_name)
+#define unw_set_caching_policy UNW_OBJ(set_caching_policy)
+#define unw_set_cache_size UNW_OBJ(set_cache_size)
+#define unw_regname UNW_ARCH_OBJ(regname)
+#define unw_flush_cache UNW_ARCH_OBJ(flush_cache)
+#define unw_strerror UNW_ARCH_OBJ(strerror)
+
+extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int);
+extern void unw_destroy_addr_space (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors_int (unw_addr_space_t);
+extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t);
+extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t);
+extern int unw_set_cache_size (unw_addr_space_t, size_t, int);
+extern const char *unw_regname (unw_regnum_t);
+
+extern int unw_init_local (unw_cursor_t *, unw_context_t *);
+extern int unw_init_local2 (unw_cursor_t *, unw_context_t *, int);
+extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *);
+extern int unw_step (unw_cursor_t *);
+extern int unw_resume (unw_cursor_t *);
+extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *);
+extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, void *);
+extern int unw_reg_states_iterate (unw_cursor_t *, unw_reg_states_callback, void *);
+extern int unw_apply_reg_state (unw_cursor_t *, void *);
+extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *);
+extern int unw_set_reg (unw_cursor_t *, int, unw_word_t);
+extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *);
+extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t);
+extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *);
+extern int unw_is_signal_frame (unw_cursor_t *);
+extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *);
+extern const char *unw_strerror (int);
+extern int unw_backtrace (void **, int);
+
+extern unw_addr_space_t unw_local_addr_space;
diff --git a/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-dynamic.h b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-dynamic.h
new file mode 100644
index 00000000000..dc31b12efc9
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-dynamic.h
@@ -0,0 +1,215 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file defines the runtime-support routines for dynamically
+generated code. Even though it is implemented as part of libunwind,
+it is logically separate from the interface to perform the actual
+unwinding. In particular, this interface is always used in the
+context of the unwind target, whereas the rest of the unwind API is
+used in context of the process that is doing the unwind (which may be
+a debugger running on another machine, for example).
+
+Note that the data-structures declared here server a dual purpose:
+when a program registers a dynamically generated procedure, it uses
+these structures directly. On the other hand, with remote-unwinding,
+the data-structures are read from the remote process's memory and
+translated into internalized versions. To facilitate remote-access,
+the following rules should be followed in declaring these structures:
+
+ (1) Declare a member as a pointer only if the the information the
+ member points to needs to be internalized as well (e.g., a
+ string representing a procedure name should be declared as
+ "const char *", but the instruction pointer should be declared
+ as unw_word_t).
+
+ (2) Provide sufficient padding to ensure that no implicit padding
+ will be needed on any of the supported target architectures. For
+ the time being, padding data structures with the assumption that
+ sizeof (unw_word_t) == 8 should be sufficient. (Note: it's not
+ impossible to internalize structures with internal padding, but
+ it does make the process a bit harder).
+
+ (3) Don't declare members that contain bitfields or floating-point
+ values.
+
+ (4) Don't declare members with enumeration types. Declare them as
+ int32_t instead. */
+
+typedef enum
+ {
+ UNW_DYN_STOP = 0, /* end-of-unwind-info marker */
+ UNW_DYN_SAVE_REG, /* save register to another register */
+ UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */
+ UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */
+ UNW_DYN_ADD, /* add constant value to a register */
+ UNW_DYN_POP_FRAMES, /* drop one or more stack frames */
+ UNW_DYN_LABEL_STATE, /* name the current state */
+ UNW_DYN_COPY_STATE, /* set the region's entry-state */
+ UNW_DYN_ALIAS /* get unwind info from an alias */
+ }
+unw_dyn_operation_t;
+
+typedef enum
+ {
+ UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */
+ UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */
+ UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */
+ UNW_INFO_FORMAT_ARM_EXIDX, /* ARM specific unwind info */
+ UNW_INFO_FORMAT_IP_OFFSET, /* Like UNW_INFO_FORMAT_REMOTE_TABLE, but
+ table entries are considered
+ relative to di->start_ip, rather
+ than di->segbase */
+ }
+unw_dyn_info_format_t;
+
+typedef struct unw_dyn_op
+ {
+ int8_t tag; /* what operation? */
+ int8_t qp; /* qualifying predicate register */
+ int16_t reg; /* what register */
+ int32_t when; /* when does it take effect? */
+ unw_word_t val; /* auxiliary value */
+ }
+unw_dyn_op_t;
+
+typedef struct unw_dyn_region_info
+ {
+ struct unw_dyn_region_info *next; /* linked list of regions */
+ int32_t insn_count; /* region length (# of instructions) */
+ uint32_t op_count; /* length of op-array */
+ unw_dyn_op_t op[1]; /* variable-length op-array */
+ }
+unw_dyn_region_info_t;
+
+typedef struct unw_dyn_proc_info
+ {
+ unw_word_t name_ptr; /* address of human-readable procedure name */
+ unw_word_t handler; /* address of personality routine */
+ uint32_t flags;
+ int32_t pad0;
+ unw_dyn_region_info_t *regions;
+ }
+unw_dyn_proc_info_t;
+
+typedef struct unw_dyn_table_info
+ {
+ unw_word_t name_ptr; /* addr. of table name (e.g., library name) */
+ unw_word_t segbase; /* segment base */
+ unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */
+ unw_word_t *table_data;
+ }
+unw_dyn_table_info_t;
+
+typedef struct unw_dyn_remote_table_info
+ {
+ unw_word_t name_ptr; /* addr. of table name (e.g., library name) */
+ unw_word_t segbase; /* segment base */
+ unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */
+ unw_word_t table_data;
+ }
+unw_dyn_remote_table_info_t;
+
+typedef struct unw_dyn_info
+ {
+ /* doubly-linked list of dyn-info structures: */
+ struct unw_dyn_info *next;
+ struct unw_dyn_info *prev;
+ unw_word_t start_ip; /* first IP covered by this entry */
+ unw_word_t end_ip; /* first IP NOT covered by this entry */
+ unw_word_t gp; /* global-pointer in effect for this entry */
+ int32_t format; /* real type: unw_dyn_info_format_t */
+ int32_t pad;
+ unw_word_t load_offset; /* ELF load offset */
+ union
+ {
+ unw_dyn_proc_info_t pi;
+ unw_dyn_table_info_t ti;
+ unw_dyn_remote_table_info_t rti;
+ }
+ u;
+ }
+unw_dyn_info_t;
+
+typedef struct unw_dyn_info_list
+ {
+ uint32_t version;
+ uint32_t generation;
+ unw_dyn_info_t *first;
+ }
+unw_dyn_info_list_t;
+
+/* Return the size (in bytes) of an unw_dyn_region_info_t structure that can
+ hold OP_COUNT ops. */
+#define _U_dyn_region_info_size(op_count) \
+ ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \
+ - (char *) NULL)
+
+/* Register the unwind info for a single procedure.
+ This routine is NOT signal-safe. */
+extern void _U_dyn_register (unw_dyn_info_t *);
+
+/* Cancel the unwind info for a single procedure.
+ This routine is NOT signal-safe. */
+extern void _U_dyn_cancel (unw_dyn_info_t *);
+
+
+/* Convenience routines. */
+
+#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \
+ ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) })
+
+#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \
+ (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst)))
+
+#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \
+ (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \
+ (offset)))
+
+#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \
+ (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \
+ (offset)))
+
+#define _U_dyn_op_add(op, qp, when, reg, value) \
+ (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value)))
+
+#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \
+ (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames)))
+
+#define _U_dyn_op_label_state(op, label) \
+ (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label)))
+
+#define _U_dyn_op_copy_state(op, label) \
+ (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label)))
+
+#define _U_dyn_op_alias(op, qp, when, addr) \
+ (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr)))
+
+#define _U_dyn_op_stop(op) \
+ (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0))
+
+/* The target-dependent qualifying predicate which is always TRUE. On
+ IA-64, that's p0 (0), on non-predicated architectures, the value is
+ ignored. */
+#define _U_QP_TRUE _U_TDEP_QP_TRUE
diff --git a/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-ppc64.h b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-ppc64.h
new file mode 100644
index 00000000000..fed478bedcd
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind-ppc64.h
@@ -0,0 +1,271 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET ppc64
+#define UNW_TARGET_PPC64 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/*
+ * This needs to be big enough to accommodate "struct cursor", while
+ * leaving some slack for future expansion. Changing this value will
+ * require recompiling all users of this library. Stack allocation is
+ * relatively cheap and unwind-state copying is relatively rare, so we want
+ * to err on making it rather too big than too small.
+ *
+ * To simplify this whole process, we are at least initially taking the
+ * tack that UNW_PPC64_* map straight across to the .eh_frame column register
+ * numbers. These register numbers come from gcc's source in
+ * gcc/config/rs6000/rs6000.h
+ *
+ * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115
+ * elements in the loc array, each sized 2 * unw_word_t, plus the rest of
+ * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's
+ * round that up to 280.
+ */
+
+#define UNW_TDEP_CURSOR_LEN 280
+
+#if __WORDSIZE==32
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+#else
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+#endif
+
+typedef double unw_tdep_fpreg_t;
+
+/*
+ * Vector register (in PowerPC64 used for AltiVec registers)
+ */
+typedef struct {
+ uint64_t halves[2];
+} unw_tdep_vreg_t;
+
+typedef enum
+ {
+ UNW_PPC64_R0,
+ UNW_PPC64_R1, /* called STACK_POINTER in gcc */
+ UNW_PPC64_R2,
+ UNW_PPC64_R3,
+ UNW_PPC64_R4,
+ UNW_PPC64_R5,
+ UNW_PPC64_R6,
+ UNW_PPC64_R7,
+ UNW_PPC64_R8,
+ UNW_PPC64_R9,
+ UNW_PPC64_R10,
+ UNW_PPC64_R11, /* called STATIC_CHAIN in gcc */
+ UNW_PPC64_R12,
+ UNW_PPC64_R13,
+ UNW_PPC64_R14,
+ UNW_PPC64_R15,
+ UNW_PPC64_R16,
+ UNW_PPC64_R17,
+ UNW_PPC64_R18,
+ UNW_PPC64_R19,
+ UNW_PPC64_R20,
+ UNW_PPC64_R21,
+ UNW_PPC64_R22,
+ UNW_PPC64_R23,
+ UNW_PPC64_R24,
+ UNW_PPC64_R25,
+ UNW_PPC64_R26,
+ UNW_PPC64_R27,
+ UNW_PPC64_R28,
+ UNW_PPC64_R29,
+ UNW_PPC64_R30,
+ UNW_PPC64_R31, /* called HARD_FRAME_POINTER in gcc */
+
+ UNW_PPC64_F0 = 32,
+ UNW_PPC64_F1,
+ UNW_PPC64_F2,
+ UNW_PPC64_F3,
+ UNW_PPC64_F4,
+ UNW_PPC64_F5,
+ UNW_PPC64_F6,
+ UNW_PPC64_F7,
+ UNW_PPC64_F8,
+ UNW_PPC64_F9,
+ UNW_PPC64_F10,
+ UNW_PPC64_F11,
+ UNW_PPC64_F12,
+ UNW_PPC64_F13,
+ UNW_PPC64_F14,
+ UNW_PPC64_F15,
+ UNW_PPC64_F16,
+ UNW_PPC64_F17,
+ UNW_PPC64_F18,
+ UNW_PPC64_F19,
+ UNW_PPC64_F20,
+ UNW_PPC64_F21,
+ UNW_PPC64_F22,
+ UNW_PPC64_F23,
+ UNW_PPC64_F24,
+ UNW_PPC64_F25,
+ UNW_PPC64_F26,
+ UNW_PPC64_F27,
+ UNW_PPC64_F28,
+ UNW_PPC64_F29,
+ UNW_PPC64_F30,
+ UNW_PPC64_F31,
+ /* Note that there doesn't appear to be an .eh_frame register column
+ for the FPSCR register. I don't know why this is. Since .eh_frame
+ info is what this implementation uses for unwinding, we have no way
+ to unwind this register, and so we will not expose an FPSCR register
+ number in the libunwind API.
+ */
+
+ UNW_PPC64_LR = 65,
+ UNW_PPC64_CTR = 66,
+ UNW_PPC64_ARG_POINTER = 67,
+
+ UNW_PPC64_CR0 = 68,
+ UNW_PPC64_CR1,
+ UNW_PPC64_CR2,
+ UNW_PPC64_CR3,
+ UNW_PPC64_CR4,
+ /* CR5 .. CR7 are currently unused */
+ UNW_PPC64_CR5,
+ UNW_PPC64_CR6,
+ UNW_PPC64_CR7,
+
+ UNW_PPC64_XER = 76,
+
+ UNW_PPC64_V0 = 77,
+ UNW_PPC64_V1,
+ UNW_PPC64_V2,
+ UNW_PPC64_V3,
+ UNW_PPC64_V4,
+ UNW_PPC64_V5,
+ UNW_PPC64_V6,
+ UNW_PPC64_V7,
+ UNW_PPC64_V8,
+ UNW_PPC64_V9,
+ UNW_PPC64_V10,
+ UNW_PPC64_V11,
+ UNW_PPC64_V12,
+ UNW_PPC64_V13,
+ UNW_PPC64_V14,
+ UNW_PPC64_V15,
+ UNW_PPC64_V16,
+ UNW_PPC64_V17,
+ UNW_PPC64_V18,
+ UNW_PPC64_V19,
+ UNW_PPC64_V20,
+ UNW_PPC64_V21,
+ UNW_PPC64_V22,
+ UNW_PPC64_V23,
+ UNW_PPC64_V24,
+ UNW_PPC64_V25,
+ UNW_PPC64_V26,
+ UNW_PPC64_V27,
+ UNW_PPC64_V28,
+ UNW_PPC64_V29,
+ UNW_PPC64_V30,
+ UNW_PPC64_V31,
+
+ UNW_PPC64_VRSAVE = 109,
+ UNW_PPC64_VSCR = 110,
+ UNW_PPC64_SPE_ACC = 111,
+ UNW_PPC64_SPEFSCR = 112,
+
+ /* frame info (read-only) */
+ UNW_PPC64_FRAME_POINTER,
+ UNW_PPC64_NIP,
+
+
+ UNW_TDEP_LAST_REG = UNW_PPC64_NIP,
+
+ UNW_TDEP_IP = UNW_PPC64_NIP,
+ UNW_TDEP_SP = UNW_PPC64_R1,
+ UNW_TDEP_EH = UNW_PPC64_R12
+ }
+ppc64_regnum_t;
+
+typedef enum
+ {
+ UNW_PPC64_ABI_ELFv1,
+ UNW_PPC64_ABI_ELFv2
+ }
+ppc64_abi_t;
+
+/*
+ * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for
+ * passing parameters to exception handlers.
+ */
+
+#define UNW_TDEP_NUM_EH_REGS 4
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On ppc64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+/* XXX this is not ideal: an application should not be prevented from
+ using the "getcontext" name just because it's using libunwind. We
+ can't just use __getcontext() either, because that isn't exported
+ by glibc... */
+#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no ppc64-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind.h b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind.h
new file mode 100644
index 00000000000..23d0075615a
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/install/include/libunwind.h
@@ -0,0 +1,40 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+#include "libunwind-aarch64.h"
+#elif defined __arm__
+# include "libunwind-arm.h"
+#elif defined __hppa__
+# include "libunwind-hppa.h"
+#elif defined __ia64__
+# include "libunwind-ia64.h"
+#elif defined __mips__
+# include "libunwind-mips.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "libunwind-ppc32.h"
+#elif defined __powerpc64__
+# include "libunwind-ppc64.h"
+#elif defined __sh__
+# include "libunwind-sh.h"
+#elif defined __i386__
+# include "libunwind-x86.h"
+#elif defined __x86_64__
+# include "libunwind-x86_64.h"
+#elif defined __tilegx__
+# include "libunwind-tilegx.h"
+#elif defined __s390x__
+# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
+#else
+# error "Unsupported arch"
+#endif
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "libunwind-ppc64.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/platform/linux_ppc64le/install/include/unwind.h b/src/third_party/unwind/platform/linux_ppc64le/install/include/unwind.h
new file mode 100644
index 00000000000..93780fade8f
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_ppc64le/install/include/unwind.h
@@ -0,0 +1,155 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef _UNWIND_H
+#define _UNWIND_H
+
+/* For uint64_t */
+#include <stdint.h>
+#include <stdalign.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Minimal interface as per C++ ABI draft standard:
+
+ http://www.codesourcery.com/cxx-abi/abi-eh.html */
+
+typedef enum
+ {
+ _URC_NO_REASON = 0,
+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+ _URC_FATAL_PHASE2_ERROR = 2,
+ _URC_FATAL_PHASE1_ERROR = 3,
+ _URC_NORMAL_STOP = 4,
+ _URC_END_OF_STACK = 5,
+ _URC_HANDLER_FOUND = 6,
+ _URC_INSTALL_CONTEXT = 7,
+ _URC_CONTINUE_UNWIND = 8
+ }
+_Unwind_Reason_Code;
+
+typedef int _Unwind_Action;
+
+#define _UA_SEARCH_PHASE 1
+#define _UA_CLEANUP_PHASE 2
+#define _UA_HANDLER_FRAME 4
+#define _UA_FORCE_UNWIND 8
+
+struct _Unwind_Context; /* opaque data-structure */
+struct _Unwind_Exception; /* forward-declaration */
+
+typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
+ struct _Unwind_Exception *);
+
+typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
+ uint64_t,
+ struct _Unwind_Exception *,
+ struct _Unwind_Context *,
+ void *);
+
+/* The C++ ABI requires exception_class, private_1, and private_2 to
+ be of type uint64 and the entire structure to be
+ double-word-aligned. Please note that exception_class stays 64-bit
+ even on 32-bit machines for gcc compatibility. */
+struct _Unwind_Exception
+ {
+ alignas(8) uint64_t exception_class;
+ _Unwind_Exception_Cleanup_Fn exception_cleanup;
+ unsigned long private_1;
+ unsigned long private_2;
+ };
+
+extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
+extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
+ _Unwind_Stop_Fn, void *);
+extern void _Unwind_Resume (struct _Unwind_Exception *);
+extern void _Unwind_DeleteException (struct _Unwind_Exception *);
+extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int);
+extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long);
+extern unsigned long _Unwind_GetIP (struct _Unwind_Context *);
+extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long);
+extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*);
+extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *);
+
+#ifdef _GNU_SOURCE
+
+/* Callback for _Unwind_Backtrace(). The backtrace stops immediately
+ if the callback returns any value other than _URC_NO_REASON. */
+typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *,
+ void *);
+
+/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why
+ _UA_END_OF_STACK exists. */
+# define _UA_END_OF_STACK 16
+
+/* If the unwind was initiated due to a forced unwind, resume that
+ operation, else re-raise the exception. This is used by
+ __cxa_rethrow(). */
+extern _Unwind_Reason_Code
+ _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *);
+
+/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why
+ _Unwind_GetBSP() exists. */
+extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *);
+
+/* Return the "canonical frame address" for the given context.
+ This is used by NPTL... */
+extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *);
+
+/* Return the base-address for data references. */
+extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *);
+
+/* Return the base-address for text references. */
+extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *);
+
+/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any
+ cleanup. The first frame for which the callback is invoked is the
+ one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace()
+ returns _URC_END_OF_STACK when the backtrace stopped due to
+ reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it
+ stops for any other reason. */
+extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *);
+
+/* Find the start-address of the procedure containing the specified IP
+ or NULL if it cannot be found (e.g., because the function has no
+ unwind info). Note: there is not necessarily a one-to-one
+ correspondence between source-level functions and procedures: some
+ functions don't have unwind-info and others are split into multiple
+ procedures. */
+extern void *_Unwind_FindEnclosingFunction (void *);
+
+/* See also Linux Standard Base Spec:
+ http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */
+
+#endif /* _GNU_SOURCE */
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _UNWIND_H */
diff --git a/src/third_party/unwind/platform/linux_s390x/build/include/config.h b/src/third_party/unwind/platform/linux_s390x/build/include/config.h
new file mode 100644
index 00000000000..eb01d1d29f9
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/build/include/config.h
@@ -0,0 +1,247 @@
+/* include/config.h. Generated from config.h.in by configure. */
+/* include/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Block signals before mutex operations */
+#define CONFIG_BLOCK_SIGNALS /**/
+
+/* Enable Debug Frame */
+/* #undef CONFIG_DEBUG_FRAME */
+
+/* Support for Microsoft ABI extensions */
+/* #undef CONFIG_MSABI_SUPPORT */
+
+/* Define if the weak 'backtrace' symbol is provided. */
+#define CONFIG_WEAK_BACKTRACE 1
+
+/* Define to 1 if you want every memory access validated */
+#define CONSERVATIVE_CHECKS 1
+
+/* Define to 1 if you have the <asm/ptrace.h> header file. */
+#define HAVE_ASM_PTRACE_H 1
+
+/* Define to 1 if you have the <asm/ptrace_offsets.h> header file. */
+/* #undef HAVE_ASM_PTRACE_OFFSETS_H */
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+#define HAVE_BYTESWAP_H 1
+
+/* Define to 1 if you have the declaration of `PTRACE_CONT', and to 0 if you
+ don't. */
+#define HAVE_DECL_PTRACE_CONT 1
+
+/* Define to 1 if you have the declaration of `PTRACE_POKEDATA', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_POKEDATA 1
+
+/* Define to 1 if you have the declaration of `PTRACE_POKEUSER', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_POKEUSER 1
+
+/* Define to 1 if you have the declaration of `PTRACE_SETREGSET', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_SETREGSET 1
+
+/* Define to 1 if you have the declaration of `PTRACE_SINGLESTEP', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_SINGLESTEP 1
+
+/* Define to 1 if you have the declaration of `PTRACE_SYSCALL', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_SYSCALL 1
+
+/* Define to 1 if you have the declaration of `PTRACE_TRACEME', and to 0 if
+ you don't. */
+#define HAVE_DECL_PTRACE_TRACEME 1
+
+/* Define to 1 if you have the declaration of `PT_CONTINUE', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_CONTINUE 1
+
+/* Define to 1 if you have the declaration of `PT_GETFPREGS', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_GETFPREGS 1
+
+/* Define to 1 if you have the declaration of `PT_GETREGS', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_GETREGS 1
+
+/* Define to 1 if you have the declaration of `PT_IO', and to 0 if you don't.
+ */
+#define HAVE_DECL_PT_IO 0
+
+/* Define to 1 if you have the declaration of `PT_STEP', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_STEP 1
+
+/* Define to 1 if you have the declaration of `PT_SYSCALL', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_SYSCALL 1
+
+/* Define to 1 if you have the declaration of `PT_TRACE_ME', and to 0 if you
+ don't. */
+#define HAVE_DECL_PT_TRACE_ME 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlmodinfo' function. */
+/* #undef HAVE_DLMODINFO */
+
+/* Define to 1 if you have the `dl_iterate_phdr' function. */
+#define HAVE_DL_ITERATE_PHDR 1
+
+/* Define to 1 if you have the `dl_phdr_removals_counter' function. */
+/* #undef HAVE_DL_PHDR_REMOVALS_COUNTER */
+
+/* Define to 1 if you have the <elf.h> header file. */
+#define HAVE_ELF_H 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define HAVE_ENDIAN_H 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#define HAVE_EXECINFO_H 1
+
+/* Define to 1 if you have the `getunwind' function. */
+/* #undef HAVE_GETUNWIND */
+
+/* Define to 1 if you have the <ia64intrin.h> header file. */
+/* #undef HAVE_IA64INTRIN_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `uca' library (-luca). */
+/* #undef HAVE_LIBUCA */
+
+/* Define to 1 if you have the <link.h> header file. */
+#define HAVE_LINK_H 1
+
+/* Define if you have liblzma */
+/* #undef HAVE_LZMA */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mincore' function. */
+#define HAVE_MINCORE 1
+
+/* Define to 1 if you have the `pipe2' function. */
+#define HAVE_PIPE2 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if `dlpi_subs' is a member of `struct dl_phdr_info'. */
+#define HAVE_STRUCT_DL_PHDR_INFO_DLPI_SUBS 1
+
+/* Define to 1 if the system has the type `struct elf_prstatus'. */
+#define HAVE_STRUCT_ELF_PRSTATUS 1
+
+/* Define to 1 if the system has the type `struct prstatus'. */
+/* #undef HAVE_STRUCT_PRSTATUS */
+
+/* Define to 1 if you have the <sys/elf.h> header file. */
+#define HAVE_SYS_ELF_H 1
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+/* #undef HAVE_SYS_ENDIAN_H */
+
+/* Define to 1 if you have the <sys/link.h> header file. */
+/* #undef HAVE_SYS_LINK_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/procfs.h> header file. */
+#define HAVE_SYS_PROCFS_H 1
+
+/* Define to 1 if you have the <sys/ptrace.h> header file. */
+#define HAVE_SYS_PTRACE_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uc_access.h> header file. */
+/* #undef HAVE_SYS_UC_ACCESS_H */
+
+/* Define to 1 if you have the `ttrace' function. */
+/* #undef HAVE_TTRACE */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have libz */
+/* #undef HAVE_ZLIB */
+
+/* Defined if __builtin_unreachable() is available */
+#define HAVE__BUILTIN_UNREACHABLE 1
+
+/* Defined if __builtin___clear_cache() is available */
+#define HAVE__BUILTIN___CLEAR_CACHE 1
+
+/* Define to 1 if --enable-per-thread-cache */
+/* #undef HAVE___CACHE_PER_THREAD */
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libunwind"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "libunwind-devel@nongnu.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libunwind"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libunwind 1.6.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libunwind"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.6.2"
+
+/* The size of `off_t', as computed by sizeof. */
+#define SIZEOF_OFF_T 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.6.2"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/third_party/unwind/platform/linux_s390x/build/include/libunwind-common.h b/src/third_party/unwind/platform/linux_s390x/build/include/libunwind-common.h
new file mode 100644
index 00000000000..9de37c1d7c0
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/build/include/libunwind-common.h
@@ -0,0 +1,292 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_VERSION_MAJOR 1
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
+
+#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
+#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
+
+#ifdef __sun
+// On SmartOS, gcc fails with the following error:
+//
+// ../include/libunwind-common.h:43:41: error: expected identifier or '(' before numeric constant
+// # define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+// ^
+//
+// workaround is to undefine _U explicitly.
+// see https://github.com/libunwind/libunwind/issues/118 for more details.
+//
+#undef _U
+#endif
+
+#define UNW_PASTE2(x,y) x##y
+#define UNW_PASTE(x,y) UNW_PASTE2(x,y)
+#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn)
+#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn)
+
+#ifdef UNW_LOCAL_ONLY
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_)
+#else /* !UNW_LOCAL_ONLY */
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+#endif /* !UNW_LOCAL_ONLY */
+
+/* Error codes. The unwind routines return the *negated* values of
+ these error codes on error and a non-negative value on success. */
+typedef enum
+ {
+ UNW_ESUCCESS = 0, /* no error */
+ UNW_EUNSPEC, /* unspecified (general) error */
+ UNW_ENOMEM, /* out of memory */
+ UNW_EBADREG, /* bad register number */
+ UNW_EREADONLYREG, /* attempt to write read-only register */
+ UNW_ESTOPUNWIND, /* stop unwinding */
+ UNW_EINVALIDIP, /* invalid IP */
+ UNW_EBADFRAME, /* bad frame */
+ UNW_EINVAL, /* unsupported operation or bad value */
+ UNW_EBADVERSION, /* unwind info has unsupported version */
+ UNW_ENOINFO /* no unwind info found */
+ }
+unw_error_t;
+
+/* The following enum defines the indices for a couple of
+ (pseudo-)registers which have the same meaning across all
+ platforms. (RO) means read-only. (RW) means read-write. General
+ registers (aka "integer registers") are expected to start with
+ index 0. The number of such registers is architecture-dependent.
+ The remaining indices can be used as an architecture sees fit. The
+ last valid register index is given by UNW_REG_LAST. */
+typedef enum
+ {
+ UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */
+ UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */
+ UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */
+ UNW_REG_LAST = UNW_TDEP_LAST_REG
+ }
+unw_frame_regnum_t;
+
+/* Number of exception-handler argument registers: */
+#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS
+
+typedef enum
+ {
+ UNW_CACHE_NONE, /* no caching */
+ UNW_CACHE_GLOBAL, /* shared global cache */
+ UNW_CACHE_PER_THREAD /* per-thread caching */
+ }
+unw_caching_policy_t;
+
+typedef enum
+ {
+ UNW_INIT_SIGNAL_FRAME = 1, /* We know this is a signal frame */
+ }
+unw_init_local2_flags_t;
+
+typedef int unw_regnum_t;
+
+/* The unwind cursor starts at the youngest (most deeply nested) frame
+ and is used to track the frame state as the unwinder steps from
+ frame to frame. It is safe to make (shallow) copies of variables
+ of this type. */
+typedef struct unw_cursor
+ {
+ unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
+ }
+unw_cursor_t;
+
+/* This type encapsulates the entire (preserved) machine-state. */
+typedef unw_tdep_context_t unw_context_t;
+
+/* unw_getcontext() fills the unw_context_t pointed to by UC with the
+ machine state as it exists at the call-site. For implementation
+ reasons, this needs to be a target-dependent macro. It's easiest
+ to think of unw_getcontext() as being identical to getcontext(). */
+#define unw_getcontext(uc) unw_tdep_getcontext(uc)
+
+/* Return 1 if register number R is a floating-point register, zero
+ otherwise.
+ This routine is signal-safe. */
+#define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
+
+typedef unw_tdep_fpreg_t unw_fpreg_t;
+
+typedef struct unw_addr_space *unw_addr_space_t;
+
+/* Each target may define it's own set of flags, but bits 0-15 are
+ reserved for general libunwind-use. */
+#define UNW_PI_FLAG_FIRST_TDEP_BIT 16
+/* The information comes from a .debug_frame section. */
+#define UNW_PI_FLAG_DEBUG_FRAME 32
+
+typedef struct unw_proc_info
+ {
+ unw_word_t start_ip; /* first IP covered by this procedure */
+ unw_word_t end_ip; /* first IP NOT covered by this procedure */
+#if defined(NEED_LAST_IP)
+ unw_word_t last_ip; /* first IP that could begin another procedure */
+#endif
+ unw_word_t lsda; /* address of lang.-spec. data area (if any) */
+ unw_word_t handler; /* optional personality routine */
+ unw_word_t gp; /* global-pointer value for this procedure */
+ unw_word_t flags; /* misc. flags */
+
+ int format; /* unwind-info format (arch-specific) */
+ int unwind_info_size; /* size of the information (if applicable) */
+ void *unwind_info; /* unwind-info (arch-specific) */
+ unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */
+ }
+unw_proc_info_t;
+
+typedef int (*unw_reg_states_callback)(void *token,
+ void *reg_states_data,
+ size_t reg_states_data_size,
+ unw_word_t start_ip, unw_word_t end_ip);
+
+/* These are backend callback routines that provide access to the
+ state of a "remote" process. This can be used, for example, to
+ unwind another process through the ptrace() interface. */
+typedef struct unw_accessors
+ {
+ /* Look up the unwind info associated with instruction-pointer IP.
+ On success, the routine fills in the PROC_INFO structure. */
+ int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *,
+ int, void *);
+
+ /* Release any resources (e.g., memory) that were allocated for
+ the unwind info returned in by a previous call to
+ find_proc_info() with NEED_UNWIND_INFO set to 1. */
+ void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *);
+
+ /* Return the list-head of the dynamically registered unwind
+ info. */
+ int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *);
+
+ /* Access aligned word at address ADDR. The value is returned
+ according to the endianness of the host (e.g., if the host is
+ little-endian and the target is big-endian, access_mem() needs
+ to byte-swap the value before returning it). */
+ int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t,
+ unw_fpreg_t *, int, void *);
+
+ int (*resume) (unw_addr_space_t, unw_cursor_t *, void *);
+
+ /* Optional call back to obtain the name of a (static) procedure.
+ Dynamically generated procedures are handled automatically by
+ libunwind. This callback is optional and may be set to
+ NULL. */
+ int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+ }
+unw_accessors_t;
+
+typedef enum unw_save_loc_type
+ {
+ UNW_SLT_NONE, /* register is not saved ("not an l-value") */
+ UNW_SLT_MEMORY, /* register has been saved in memory */
+ UNW_SLT_REG /* register has been saved in (another) register */
+ }
+unw_save_loc_type_t;
+
+typedef struct unw_save_loc
+ {
+ unw_save_loc_type_t type;
+ union
+ {
+ unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */
+ unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */
+ }
+ u;
+ unw_tdep_save_loc_t extra; /* target-dependent additional information */
+ }
+unw_save_loc_t;
+
+/* These routines work both for local and remote unwinding. */
+
+#define unw_local_addr_space UNW_OBJ(local_addr_space)
+#define unw_create_addr_space UNW_OBJ(create_addr_space)
+#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space)
+#define unw_get_accessors UNW_ARCH_OBJ(get_accessors)
+#define unw_get_accessors_int UNW_ARCH_OBJ(get_accessors_int)
+#define unw_init_local UNW_OBJ(init_local)
+#define unw_init_local2 UNW_OBJ(init_local2)
+#define unw_init_remote UNW_OBJ(init_remote)
+#define unw_step UNW_OBJ(step)
+#define unw_resume UNW_OBJ(resume)
+#define unw_get_proc_info UNW_OBJ(get_proc_info)
+#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip)
+#define unw_reg_states_iterate UNW_OBJ(reg_states_iterate)
+#define unw_apply_reg_state UNW_OBJ(apply_reg_state)
+#define unw_get_reg UNW_OBJ(get_reg)
+#define unw_set_reg UNW_OBJ(set_reg)
+#define unw_get_fpreg UNW_OBJ(get_fpreg)
+#define unw_set_fpreg UNW_OBJ(set_fpreg)
+#define unw_get_save_loc UNW_OBJ(get_save_loc)
+#define unw_is_signal_frame UNW_OBJ(is_signal_frame)
+#define unw_get_proc_name UNW_OBJ(get_proc_name)
+#define unw_set_caching_policy UNW_OBJ(set_caching_policy)
+#define unw_set_cache_size UNW_OBJ(set_cache_size)
+#define unw_regname UNW_ARCH_OBJ(regname)
+#define unw_flush_cache UNW_ARCH_OBJ(flush_cache)
+#define unw_strerror UNW_ARCH_OBJ(strerror)
+
+extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int);
+extern void unw_destroy_addr_space (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors_int (unw_addr_space_t);
+extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t);
+extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t);
+extern int unw_set_cache_size (unw_addr_space_t, size_t, int);
+extern const char *unw_regname (unw_regnum_t);
+
+extern int unw_init_local (unw_cursor_t *, unw_context_t *);
+extern int unw_init_local2 (unw_cursor_t *, unw_context_t *, int);
+extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *);
+extern int unw_step (unw_cursor_t *);
+extern int unw_resume (unw_cursor_t *);
+extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *);
+extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, void *);
+extern int unw_reg_states_iterate (unw_cursor_t *, unw_reg_states_callback, void *);
+extern int unw_apply_reg_state (unw_cursor_t *, void *);
+extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *);
+extern int unw_set_reg (unw_cursor_t *, int, unw_word_t);
+extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *);
+extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t);
+extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *);
+extern int unw_is_signal_frame (unw_cursor_t *);
+extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *);
+extern const char *unw_strerror (int);
+extern int unw_backtrace (void **, int);
+
+extern unw_addr_space_t unw_local_addr_space;
diff --git a/src/third_party/unwind/platform/linux_s390x/build/include/libunwind.h b/src/third_party/unwind/platform/linux_s390x/build/include/libunwind.h
new file mode 100644
index 00000000000..309c9e08821
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/build/include/libunwind.h
@@ -0,0 +1,40 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+#include "libunwind-aarch64.h"
+#elif defined __arm__
+# include "libunwind-arm.h"
+#elif defined __hppa__
+# include "libunwind-hppa.h"
+#elif defined __ia64__
+# include "libunwind-ia64.h"
+#elif defined __mips__
+# include "libunwind-mips.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "libunwind-ppc32.h"
+#elif defined __powerpc64__
+# include "libunwind-ppc64.h"
+#elif defined __sh__
+# include "libunwind-sh.h"
+#elif defined __i386__
+# include "libunwind-x86.h"
+#elif defined __x86_64__
+# include "libunwind-x86_64.h"
+#elif defined __tilegx__
+# include "libunwind-tilegx.h"
+#elif defined __s390x__
+# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
+#else
+# error "Unsupported arch"
+#endif
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "libunwind-s390x.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/platform/linux_s390x/build/include/stamp-h1 b/src/third_party/unwind/platform/linux_s390x/build/include/stamp-h1
new file mode 100644
index 00000000000..b330768e9bf
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/build/include/stamp-h1
@@ -0,0 +1 @@
+timestamp for include/config.h
diff --git a/src/third_party/unwind/platform/linux_s390x/build/include/tdep/libunwind_i.h b/src/third_party/unwind/platform/linux_s390x/build/include/tdep/libunwind_i.h
new file mode 100644
index 00000000000..6a078561bc4
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/build/include/tdep/libunwind_i.h
@@ -0,0 +1,41 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+# include "tdep-aarch64/libunwind_i.h"
+#elif defined __arm__
+# include "tdep-arm/libunwind_i.h"
+#elif defined __hppa__
+# include "tdep-hppa/libunwind_i.h"
+#elif defined __ia64__
+# include "tdep-ia64/libunwind_i.h"
+#elif defined __mips__
+# include "tdep-mips/libunwind_i.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "tdep-ppc32/libunwind_i.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/libunwind_i.h"
+#elif defined __sh__
+# include "tdep-sh/libunwind_i.h"
+#elif defined __i386__
+# include "tdep-x86/libunwind_i.h"
+#elif defined __x86_64__
+# include "tdep-x86_64/libunwind_i.h"
+#elif defined __tilegx__
+# include "tdep-tilegx/libunwind_i.h"
+#elif defined __s390x__
+# include "tdep-s390x/libunwind_i.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/libunwind_i.h"
+#else
+# error "Unsupported arch"
+#endif
+
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "tdep-s390x/libunwind_i.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-common.h b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-common.h
new file mode 100644
index 00000000000..9de37c1d7c0
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-common.h
@@ -0,0 +1,292 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_VERSION_MAJOR 1
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
+
+#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
+#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
+
+#ifdef __sun
+// On SmartOS, gcc fails with the following error:
+//
+// ../include/libunwind-common.h:43:41: error: expected identifier or '(' before numeric constant
+// # define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+// ^
+//
+// workaround is to undefine _U explicitly.
+// see https://github.com/libunwind/libunwind/issues/118 for more details.
+//
+#undef _U
+#endif
+
+#define UNW_PASTE2(x,y) x##y
+#define UNW_PASTE(x,y) UNW_PASTE2(x,y)
+#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn)
+#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn)
+
+#ifdef UNW_LOCAL_ONLY
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_)
+#else /* !UNW_LOCAL_ONLY */
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+#endif /* !UNW_LOCAL_ONLY */
+
+/* Error codes. The unwind routines return the *negated* values of
+ these error codes on error and a non-negative value on success. */
+typedef enum
+ {
+ UNW_ESUCCESS = 0, /* no error */
+ UNW_EUNSPEC, /* unspecified (general) error */
+ UNW_ENOMEM, /* out of memory */
+ UNW_EBADREG, /* bad register number */
+ UNW_EREADONLYREG, /* attempt to write read-only register */
+ UNW_ESTOPUNWIND, /* stop unwinding */
+ UNW_EINVALIDIP, /* invalid IP */
+ UNW_EBADFRAME, /* bad frame */
+ UNW_EINVAL, /* unsupported operation or bad value */
+ UNW_EBADVERSION, /* unwind info has unsupported version */
+ UNW_ENOINFO /* no unwind info found */
+ }
+unw_error_t;
+
+/* The following enum defines the indices for a couple of
+ (pseudo-)registers which have the same meaning across all
+ platforms. (RO) means read-only. (RW) means read-write. General
+ registers (aka "integer registers") are expected to start with
+ index 0. The number of such registers is architecture-dependent.
+ The remaining indices can be used as an architecture sees fit. The
+ last valid register index is given by UNW_REG_LAST. */
+typedef enum
+ {
+ UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */
+ UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */
+ UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */
+ UNW_REG_LAST = UNW_TDEP_LAST_REG
+ }
+unw_frame_regnum_t;
+
+/* Number of exception-handler argument registers: */
+#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS
+
+typedef enum
+ {
+ UNW_CACHE_NONE, /* no caching */
+ UNW_CACHE_GLOBAL, /* shared global cache */
+ UNW_CACHE_PER_THREAD /* per-thread caching */
+ }
+unw_caching_policy_t;
+
+typedef enum
+ {
+ UNW_INIT_SIGNAL_FRAME = 1, /* We know this is a signal frame */
+ }
+unw_init_local2_flags_t;
+
+typedef int unw_regnum_t;
+
+/* The unwind cursor starts at the youngest (most deeply nested) frame
+ and is used to track the frame state as the unwinder steps from
+ frame to frame. It is safe to make (shallow) copies of variables
+ of this type. */
+typedef struct unw_cursor
+ {
+ unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
+ }
+unw_cursor_t;
+
+/* This type encapsulates the entire (preserved) machine-state. */
+typedef unw_tdep_context_t unw_context_t;
+
+/* unw_getcontext() fills the unw_context_t pointed to by UC with the
+ machine state as it exists at the call-site. For implementation
+ reasons, this needs to be a target-dependent macro. It's easiest
+ to think of unw_getcontext() as being identical to getcontext(). */
+#define unw_getcontext(uc) unw_tdep_getcontext(uc)
+
+/* Return 1 if register number R is a floating-point register, zero
+ otherwise.
+ This routine is signal-safe. */
+#define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
+
+typedef unw_tdep_fpreg_t unw_fpreg_t;
+
+typedef struct unw_addr_space *unw_addr_space_t;
+
+/* Each target may define it's own set of flags, but bits 0-15 are
+ reserved for general libunwind-use. */
+#define UNW_PI_FLAG_FIRST_TDEP_BIT 16
+/* The information comes from a .debug_frame section. */
+#define UNW_PI_FLAG_DEBUG_FRAME 32
+
+typedef struct unw_proc_info
+ {
+ unw_word_t start_ip; /* first IP covered by this procedure */
+ unw_word_t end_ip; /* first IP NOT covered by this procedure */
+#if defined(NEED_LAST_IP)
+ unw_word_t last_ip; /* first IP that could begin another procedure */
+#endif
+ unw_word_t lsda; /* address of lang.-spec. data area (if any) */
+ unw_word_t handler; /* optional personality routine */
+ unw_word_t gp; /* global-pointer value for this procedure */
+ unw_word_t flags; /* misc. flags */
+
+ int format; /* unwind-info format (arch-specific) */
+ int unwind_info_size; /* size of the information (if applicable) */
+ void *unwind_info; /* unwind-info (arch-specific) */
+ unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */
+ }
+unw_proc_info_t;
+
+typedef int (*unw_reg_states_callback)(void *token,
+ void *reg_states_data,
+ size_t reg_states_data_size,
+ unw_word_t start_ip, unw_word_t end_ip);
+
+/* These are backend callback routines that provide access to the
+ state of a "remote" process. This can be used, for example, to
+ unwind another process through the ptrace() interface. */
+typedef struct unw_accessors
+ {
+ /* Look up the unwind info associated with instruction-pointer IP.
+ On success, the routine fills in the PROC_INFO structure. */
+ int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *,
+ int, void *);
+
+ /* Release any resources (e.g., memory) that were allocated for
+ the unwind info returned in by a previous call to
+ find_proc_info() with NEED_UNWIND_INFO set to 1. */
+ void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *);
+
+ /* Return the list-head of the dynamically registered unwind
+ info. */
+ int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *);
+
+ /* Access aligned word at address ADDR. The value is returned
+ according to the endianness of the host (e.g., if the host is
+ little-endian and the target is big-endian, access_mem() needs
+ to byte-swap the value before returning it). */
+ int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t,
+ unw_fpreg_t *, int, void *);
+
+ int (*resume) (unw_addr_space_t, unw_cursor_t *, void *);
+
+ /* Optional call back to obtain the name of a (static) procedure.
+ Dynamically generated procedures are handled automatically by
+ libunwind. This callback is optional and may be set to
+ NULL. */
+ int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+ }
+unw_accessors_t;
+
+typedef enum unw_save_loc_type
+ {
+ UNW_SLT_NONE, /* register is not saved ("not an l-value") */
+ UNW_SLT_MEMORY, /* register has been saved in memory */
+ UNW_SLT_REG /* register has been saved in (another) register */
+ }
+unw_save_loc_type_t;
+
+typedef struct unw_save_loc
+ {
+ unw_save_loc_type_t type;
+ union
+ {
+ unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */
+ unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */
+ }
+ u;
+ unw_tdep_save_loc_t extra; /* target-dependent additional information */
+ }
+unw_save_loc_t;
+
+/* These routines work both for local and remote unwinding. */
+
+#define unw_local_addr_space UNW_OBJ(local_addr_space)
+#define unw_create_addr_space UNW_OBJ(create_addr_space)
+#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space)
+#define unw_get_accessors UNW_ARCH_OBJ(get_accessors)
+#define unw_get_accessors_int UNW_ARCH_OBJ(get_accessors_int)
+#define unw_init_local UNW_OBJ(init_local)
+#define unw_init_local2 UNW_OBJ(init_local2)
+#define unw_init_remote UNW_OBJ(init_remote)
+#define unw_step UNW_OBJ(step)
+#define unw_resume UNW_OBJ(resume)
+#define unw_get_proc_info UNW_OBJ(get_proc_info)
+#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip)
+#define unw_reg_states_iterate UNW_OBJ(reg_states_iterate)
+#define unw_apply_reg_state UNW_OBJ(apply_reg_state)
+#define unw_get_reg UNW_OBJ(get_reg)
+#define unw_set_reg UNW_OBJ(set_reg)
+#define unw_get_fpreg UNW_OBJ(get_fpreg)
+#define unw_set_fpreg UNW_OBJ(set_fpreg)
+#define unw_get_save_loc UNW_OBJ(get_save_loc)
+#define unw_is_signal_frame UNW_OBJ(is_signal_frame)
+#define unw_get_proc_name UNW_OBJ(get_proc_name)
+#define unw_set_caching_policy UNW_OBJ(set_caching_policy)
+#define unw_set_cache_size UNW_OBJ(set_cache_size)
+#define unw_regname UNW_ARCH_OBJ(regname)
+#define unw_flush_cache UNW_ARCH_OBJ(flush_cache)
+#define unw_strerror UNW_ARCH_OBJ(strerror)
+
+extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int);
+extern void unw_destroy_addr_space (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors_int (unw_addr_space_t);
+extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t);
+extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t);
+extern int unw_set_cache_size (unw_addr_space_t, size_t, int);
+extern const char *unw_regname (unw_regnum_t);
+
+extern int unw_init_local (unw_cursor_t *, unw_context_t *);
+extern int unw_init_local2 (unw_cursor_t *, unw_context_t *, int);
+extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *);
+extern int unw_step (unw_cursor_t *);
+extern int unw_resume (unw_cursor_t *);
+extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *);
+extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, void *);
+extern int unw_reg_states_iterate (unw_cursor_t *, unw_reg_states_callback, void *);
+extern int unw_apply_reg_state (unw_cursor_t *, void *);
+extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *);
+extern int unw_set_reg (unw_cursor_t *, int, unw_word_t);
+extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *);
+extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t);
+extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *);
+extern int unw_is_signal_frame (unw_cursor_t *);
+extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *);
+extern const char *unw_strerror (int);
+extern int unw_backtrace (void **, int);
+
+extern unw_addr_space_t unw_local_addr_space;
diff --git a/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-dynamic.h b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-dynamic.h
new file mode 100644
index 00000000000..dc31b12efc9
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-dynamic.h
@@ -0,0 +1,215 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file defines the runtime-support routines for dynamically
+generated code. Even though it is implemented as part of libunwind,
+it is logically separate from the interface to perform the actual
+unwinding. In particular, this interface is always used in the
+context of the unwind target, whereas the rest of the unwind API is
+used in context of the process that is doing the unwind (which may be
+a debugger running on another machine, for example).
+
+Note that the data-structures declared here server a dual purpose:
+when a program registers a dynamically generated procedure, it uses
+these structures directly. On the other hand, with remote-unwinding,
+the data-structures are read from the remote process's memory and
+translated into internalized versions. To facilitate remote-access,
+the following rules should be followed in declaring these structures:
+
+ (1) Declare a member as a pointer only if the the information the
+ member points to needs to be internalized as well (e.g., a
+ string representing a procedure name should be declared as
+ "const char *", but the instruction pointer should be declared
+ as unw_word_t).
+
+ (2) Provide sufficient padding to ensure that no implicit padding
+ will be needed on any of the supported target architectures. For
+ the time being, padding data structures with the assumption that
+ sizeof (unw_word_t) == 8 should be sufficient. (Note: it's not
+ impossible to internalize structures with internal padding, but
+ it does make the process a bit harder).
+
+ (3) Don't declare members that contain bitfields or floating-point
+ values.
+
+ (4) Don't declare members with enumeration types. Declare them as
+ int32_t instead. */
+
+typedef enum
+ {
+ UNW_DYN_STOP = 0, /* end-of-unwind-info marker */
+ UNW_DYN_SAVE_REG, /* save register to another register */
+ UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */
+ UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */
+ UNW_DYN_ADD, /* add constant value to a register */
+ UNW_DYN_POP_FRAMES, /* drop one or more stack frames */
+ UNW_DYN_LABEL_STATE, /* name the current state */
+ UNW_DYN_COPY_STATE, /* set the region's entry-state */
+ UNW_DYN_ALIAS /* get unwind info from an alias */
+ }
+unw_dyn_operation_t;
+
+typedef enum
+ {
+ UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */
+ UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */
+ UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */
+ UNW_INFO_FORMAT_ARM_EXIDX, /* ARM specific unwind info */
+ UNW_INFO_FORMAT_IP_OFFSET, /* Like UNW_INFO_FORMAT_REMOTE_TABLE, but
+ table entries are considered
+ relative to di->start_ip, rather
+ than di->segbase */
+ }
+unw_dyn_info_format_t;
+
+typedef struct unw_dyn_op
+ {
+ int8_t tag; /* what operation? */
+ int8_t qp; /* qualifying predicate register */
+ int16_t reg; /* what register */
+ int32_t when; /* when does it take effect? */
+ unw_word_t val; /* auxiliary value */
+ }
+unw_dyn_op_t;
+
+typedef struct unw_dyn_region_info
+ {
+ struct unw_dyn_region_info *next; /* linked list of regions */
+ int32_t insn_count; /* region length (# of instructions) */
+ uint32_t op_count; /* length of op-array */
+ unw_dyn_op_t op[1]; /* variable-length op-array */
+ }
+unw_dyn_region_info_t;
+
+typedef struct unw_dyn_proc_info
+ {
+ unw_word_t name_ptr; /* address of human-readable procedure name */
+ unw_word_t handler; /* address of personality routine */
+ uint32_t flags;
+ int32_t pad0;
+ unw_dyn_region_info_t *regions;
+ }
+unw_dyn_proc_info_t;
+
+typedef struct unw_dyn_table_info
+ {
+ unw_word_t name_ptr; /* addr. of table name (e.g., library name) */
+ unw_word_t segbase; /* segment base */
+ unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */
+ unw_word_t *table_data;
+ }
+unw_dyn_table_info_t;
+
+typedef struct unw_dyn_remote_table_info
+ {
+ unw_word_t name_ptr; /* addr. of table name (e.g., library name) */
+ unw_word_t segbase; /* segment base */
+ unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */
+ unw_word_t table_data;
+ }
+unw_dyn_remote_table_info_t;
+
+typedef struct unw_dyn_info
+ {
+ /* doubly-linked list of dyn-info structures: */
+ struct unw_dyn_info *next;
+ struct unw_dyn_info *prev;
+ unw_word_t start_ip; /* first IP covered by this entry */
+ unw_word_t end_ip; /* first IP NOT covered by this entry */
+ unw_word_t gp; /* global-pointer in effect for this entry */
+ int32_t format; /* real type: unw_dyn_info_format_t */
+ int32_t pad;
+ unw_word_t load_offset; /* ELF load offset */
+ union
+ {
+ unw_dyn_proc_info_t pi;
+ unw_dyn_table_info_t ti;
+ unw_dyn_remote_table_info_t rti;
+ }
+ u;
+ }
+unw_dyn_info_t;
+
+typedef struct unw_dyn_info_list
+ {
+ uint32_t version;
+ uint32_t generation;
+ unw_dyn_info_t *first;
+ }
+unw_dyn_info_list_t;
+
+/* Return the size (in bytes) of an unw_dyn_region_info_t structure that can
+ hold OP_COUNT ops. */
+#define _U_dyn_region_info_size(op_count) \
+ ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \
+ - (char *) NULL)
+
+/* Register the unwind info for a single procedure.
+ This routine is NOT signal-safe. */
+extern void _U_dyn_register (unw_dyn_info_t *);
+
+/* Cancel the unwind info for a single procedure.
+ This routine is NOT signal-safe. */
+extern void _U_dyn_cancel (unw_dyn_info_t *);
+
+
+/* Convenience routines. */
+
+#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \
+ ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) })
+
+#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \
+ (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst)))
+
+#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \
+ (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \
+ (offset)))
+
+#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \
+ (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \
+ (offset)))
+
+#define _U_dyn_op_add(op, qp, when, reg, value) \
+ (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value)))
+
+#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \
+ (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames)))
+
+#define _U_dyn_op_label_state(op, label) \
+ (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label)))
+
+#define _U_dyn_op_copy_state(op, label) \
+ (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label)))
+
+#define _U_dyn_op_alias(op, qp, when, addr) \
+ (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr)))
+
+#define _U_dyn_op_stop(op) \
+ (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0))
+
+/* The target-dependent qualifying predicate which is always TRUE. On
+ IA-64, that's p0 (0), on non-predicated architectures, the value is
+ ignored. */
+#define _U_QP_TRUE _U_TDEP_QP_TRUE
diff --git a/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-s390x.h b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-s390x.h
new file mode 100644
index 00000000000..ebda40d57af
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind-s390x.h
@@ -0,0 +1,144 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for s390x by Michael Munday <mike.munday@ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET s390x
+#define UNW_TARGET_S390X 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+#define UNW_TDEP_CURSOR_LEN 384
+
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+
+typedef double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ /* general purpose registers */
+ UNW_S390X_R0,
+ UNW_S390X_R1,
+ UNW_S390X_R2,
+ UNW_S390X_R3,
+ UNW_S390X_R4,
+ UNW_S390X_R5,
+ UNW_S390X_R6,
+ UNW_S390X_R7,
+ UNW_S390X_R8,
+ UNW_S390X_R9,
+ UNW_S390X_R10,
+ UNW_S390X_R11,
+ UNW_S390X_R12,
+ UNW_S390X_R13,
+ UNW_S390X_R14,
+ UNW_S390X_R15,
+
+ /* floating point registers */
+ UNW_S390X_F0,
+ UNW_S390X_F1,
+ UNW_S390X_F2,
+ UNW_S390X_F3,
+ UNW_S390X_F4,
+ UNW_S390X_F5,
+ UNW_S390X_F6,
+ UNW_S390X_F7,
+ UNW_S390X_F8,
+ UNW_S390X_F9,
+ UNW_S390X_F10,
+ UNW_S390X_F11,
+ UNW_S390X_F12,
+ UNW_S390X_F13,
+ UNW_S390X_F14,
+ UNW_S390X_F15,
+
+ /* PSW */
+ UNW_S390X_IP,
+
+ UNW_TDEP_LAST_REG = UNW_S390X_IP,
+
+ /* TODO: access, vector registers */
+
+ /* frame info (read-only) */
+ UNW_S390X_CFA,
+
+ UNW_TDEP_IP = UNW_S390X_IP,
+ UNW_TDEP_SP = UNW_S390X_R15,
+
+ /* TODO: placeholders */
+ UNW_TDEP_EH = UNW_S390X_R0,
+ }
+s390x_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ char unused;
+ }
+unw_tdep_save_loc_t;
+
+/* On s390x, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+typedef struct
+ {
+ /* no s390x-specific auxiliary proc-info */
+ char unused;
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-dynamic.h"
+#include "libunwind-common.h"
+
+#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext)
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+
+extern int unw_tdep_getcontext (unw_tdep_context_t *);
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/third_party/unwind/platform/linux_s390x/install/include/libunwind.h b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind.h
new file mode 100644
index 00000000000..309c9e08821
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/install/include/libunwind.h
@@ -0,0 +1,40 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+#include "libunwind-aarch64.h"
+#elif defined __arm__
+# include "libunwind-arm.h"
+#elif defined __hppa__
+# include "libunwind-hppa.h"
+#elif defined __ia64__
+# include "libunwind-ia64.h"
+#elif defined __mips__
+# include "libunwind-mips.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "libunwind-ppc32.h"
+#elif defined __powerpc64__
+# include "libunwind-ppc64.h"
+#elif defined __sh__
+# include "libunwind-sh.h"
+#elif defined __i386__
+# include "libunwind-x86.h"
+#elif defined __x86_64__
+# include "libunwind-x86_64.h"
+#elif defined __tilegx__
+# include "libunwind-tilegx.h"
+#elif defined __s390x__
+# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
+#else
+# error "Unsupported arch"
+#endif
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "libunwind-s390x.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/platform/linux_s390x/install/include/unwind.h b/src/third_party/unwind/platform/linux_s390x/install/include/unwind.h
new file mode 100644
index 00000000000..93780fade8f
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_s390x/install/include/unwind.h
@@ -0,0 +1,155 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef _UNWIND_H
+#define _UNWIND_H
+
+/* For uint64_t */
+#include <stdint.h>
+#include <stdalign.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Minimal interface as per C++ ABI draft standard:
+
+ http://www.codesourcery.com/cxx-abi/abi-eh.html */
+
+typedef enum
+ {
+ _URC_NO_REASON = 0,
+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+ _URC_FATAL_PHASE2_ERROR = 2,
+ _URC_FATAL_PHASE1_ERROR = 3,
+ _URC_NORMAL_STOP = 4,
+ _URC_END_OF_STACK = 5,
+ _URC_HANDLER_FOUND = 6,
+ _URC_INSTALL_CONTEXT = 7,
+ _URC_CONTINUE_UNWIND = 8
+ }
+_Unwind_Reason_Code;
+
+typedef int _Unwind_Action;
+
+#define _UA_SEARCH_PHASE 1
+#define _UA_CLEANUP_PHASE 2
+#define _UA_HANDLER_FRAME 4
+#define _UA_FORCE_UNWIND 8
+
+struct _Unwind_Context; /* opaque data-structure */
+struct _Unwind_Exception; /* forward-declaration */
+
+typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
+ struct _Unwind_Exception *);
+
+typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
+ uint64_t,
+ struct _Unwind_Exception *,
+ struct _Unwind_Context *,
+ void *);
+
+/* The C++ ABI requires exception_class, private_1, and private_2 to
+ be of type uint64 and the entire structure to be
+ double-word-aligned. Please note that exception_class stays 64-bit
+ even on 32-bit machines for gcc compatibility. */
+struct _Unwind_Exception
+ {
+ alignas(8) uint64_t exception_class;
+ _Unwind_Exception_Cleanup_Fn exception_cleanup;
+ unsigned long private_1;
+ unsigned long private_2;
+ };
+
+extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
+extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
+ _Unwind_Stop_Fn, void *);
+extern void _Unwind_Resume (struct _Unwind_Exception *);
+extern void _Unwind_DeleteException (struct _Unwind_Exception *);
+extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int);
+extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long);
+extern unsigned long _Unwind_GetIP (struct _Unwind_Context *);
+extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long);
+extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*);
+extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *);
+
+#ifdef _GNU_SOURCE
+
+/* Callback for _Unwind_Backtrace(). The backtrace stops immediately
+ if the callback returns any value other than _URC_NO_REASON. */
+typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *,
+ void *);
+
+/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why
+ _UA_END_OF_STACK exists. */
+# define _UA_END_OF_STACK 16
+
+/* If the unwind was initiated due to a forced unwind, resume that
+ operation, else re-raise the exception. This is used by
+ __cxa_rethrow(). */
+extern _Unwind_Reason_Code
+ _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *);
+
+/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why
+ _Unwind_GetBSP() exists. */
+extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *);
+
+/* Return the "canonical frame address" for the given context.
+ This is used by NPTL... */
+extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *);
+
+/* Return the base-address for data references. */
+extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *);
+
+/* Return the base-address for text references. */
+extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *);
+
+/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any
+ cleanup. The first frame for which the callback is invoked is the
+ one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace()
+ returns _URC_END_OF_STACK when the backtrace stopped due to
+ reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it
+ stops for any other reason. */
+extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *);
+
+/* Find the start-address of the procedure containing the specified IP
+ or NULL if it cannot be found (e.g., because the function has no
+ unwind info). Note: there is not necessarily a one-to-one
+ correspondence between source-level functions and procedures: some
+ functions don't have unwind-info and others are split into multiple
+ procedures. */
+extern void *_Unwind_FindEnclosingFunction (void *);
+
+/* See also Linux Standard Base Spec:
+ http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */
+
+#endif /* _GNU_SOURCE */
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _UNWIND_H */