aboutsummaryrefslogtreecommitdiff
path: root/lib/libunwind/include
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-01 16:39:13 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-01 16:39:31 -0700
commitceb3819c42254c1d379d4a0416009d136bbb0385 (patch)
treee54a495c392e190188ec55f5d48ebce8dcfb26e6 /lib/libunwind/include
parentaa964bd555bf7d034b5bfea6275d6edddc35cb8c (diff)
downloadzig-ceb3819c42254c1d379d4a0416009d136bbb0385.tar.gz
zig-ceb3819c42254c1d379d4a0416009d136bbb0385.zip
update libunwind to llvm 14.0.6
Diffstat (limited to 'lib/libunwind/include')
-rw-r--r--lib/libunwind/include/__libunwind_config.h15
-rw-r--r--lib/libunwind/include/libunwind.h218
-rw-r--r--lib/libunwind/include/mach-o/compact_unwind_encoding.h2
-rw-r--r--lib/libunwind/include/unwind.h198
-rw-r--r--lib/libunwind/include/unwind_arm_ehabi.h170
-rw-r--r--lib/libunwind/include/unwind_itanium.h76
6 files changed, 406 insertions, 273 deletions
diff --git a/lib/libunwind/include/__libunwind_config.h b/lib/libunwind/include/__libunwind_config.h
index 438d6a705d..e87bcf4003 100644
--- a/lib/libunwind/include/__libunwind_config.h
+++ b/lib/libunwind/include/__libunwind_config.h
@@ -1,4 +1,4 @@
-//===------------------------- __libunwind_config.h -----------------------===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -56,7 +56,7 @@
# define _LIBUNWIND_CONTEXT_SIZE 167
# define _LIBUNWIND_CURSOR_SIZE 179
# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
-# elif defined(__ppc__)
+# elif defined(__powerpc__)
# define _LIBUNWIND_TARGET_PPC 1
# define _LIBUNWIND_CONTEXT_SIZE 117
# define _LIBUNWIND_CURSOR_SIZE 124
@@ -126,11 +126,12 @@
# error "Unsupported MIPS ABI and/or environment"
# endif
# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS
-# elif defined(__sparc__) && defined(__arch64__)
-# define _LIBUNWIND_TARGET_SPARC64 1
-# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64
-# define _LIBUNWIND_CONTEXT_SIZE 33
-# define _LIBUNWIND_CURSOR_SIZE 45
+#elif defined(__sparc__) && defined(__arch64__)
+#define _LIBUNWIND_TARGET_SPARC64 1
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER \
+ _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64
+#define _LIBUNWIND_CONTEXT_SIZE 33
+#define _LIBUNWIND_CURSOR_SIZE 45
# elif defined(__sparc__)
#define _LIBUNWIND_TARGET_SPARC 1
#define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC
diff --git a/lib/libunwind/include/libunwind.h b/lib/libunwind/include/libunwind.h
index 0feecd7bd6..9a74faa48d 100644
--- a/lib/libunwind/include/libunwind.h
+++ b/lib/libunwind/include/libunwind.h
@@ -1,4 +1,4 @@
-//===---------------------------- libunwind.h -----------------------------===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -493,77 +493,150 @@ enum {
// 64-bit ARM64 registers
enum {
- UNW_ARM64_X0 = 0,
- UNW_ARM64_X1 = 1,
- UNW_ARM64_X2 = 2,
- UNW_ARM64_X3 = 3,
- UNW_ARM64_X4 = 4,
- UNW_ARM64_X5 = 5,
- UNW_ARM64_X6 = 6,
- UNW_ARM64_X7 = 7,
- UNW_ARM64_X8 = 8,
- UNW_ARM64_X9 = 9,
- UNW_ARM64_X10 = 10,
- UNW_ARM64_X11 = 11,
- UNW_ARM64_X12 = 12,
- UNW_ARM64_X13 = 13,
- UNW_ARM64_X14 = 14,
- UNW_ARM64_X15 = 15,
- UNW_ARM64_X16 = 16,
- UNW_ARM64_X17 = 17,
- UNW_ARM64_X18 = 18,
- UNW_ARM64_X19 = 19,
- UNW_ARM64_X20 = 20,
- UNW_ARM64_X21 = 21,
- UNW_ARM64_X22 = 22,
- UNW_ARM64_X23 = 23,
- UNW_ARM64_X24 = 24,
- UNW_ARM64_X25 = 25,
- UNW_ARM64_X26 = 26,
- UNW_ARM64_X27 = 27,
- UNW_ARM64_X28 = 28,
- UNW_ARM64_X29 = 29,
- UNW_ARM64_FP = 29,
- UNW_ARM64_X30 = 30,
- UNW_ARM64_LR = 30,
- UNW_ARM64_X31 = 31,
- UNW_ARM64_SP = 31,
- UNW_ARM64_PC = 32,
- // reserved block
- UNW_ARM64_RA_SIGN_STATE = 34,
+ UNW_AARCH64_X0 = 0,
+ UNW_AARCH64_X1 = 1,
+ UNW_AARCH64_X2 = 2,
+ UNW_AARCH64_X3 = 3,
+ UNW_AARCH64_X4 = 4,
+ UNW_AARCH64_X5 = 5,
+ UNW_AARCH64_X6 = 6,
+ UNW_AARCH64_X7 = 7,
+ UNW_AARCH64_X8 = 8,
+ UNW_AARCH64_X9 = 9,
+ UNW_AARCH64_X10 = 10,
+ UNW_AARCH64_X11 = 11,
+ UNW_AARCH64_X12 = 12,
+ UNW_AARCH64_X13 = 13,
+ UNW_AARCH64_X14 = 14,
+ UNW_AARCH64_X15 = 15,
+ UNW_AARCH64_X16 = 16,
+ UNW_AARCH64_X17 = 17,
+ UNW_AARCH64_X18 = 18,
+ UNW_AARCH64_X19 = 19,
+ UNW_AARCH64_X20 = 20,
+ UNW_AARCH64_X21 = 21,
+ UNW_AARCH64_X22 = 22,
+ UNW_AARCH64_X23 = 23,
+ UNW_AARCH64_X24 = 24,
+ UNW_AARCH64_X25 = 25,
+ UNW_AARCH64_X26 = 26,
+ UNW_AARCH64_X27 = 27,
+ UNW_AARCH64_X28 = 28,
+ UNW_AARCH64_X29 = 29,
+ UNW_AARCH64_FP = 29,
+ UNW_AARCH64_X30 = 30,
+ UNW_AARCH64_LR = 30,
+ UNW_AARCH64_X31 = 31,
+ UNW_AARCH64_SP = 31,
+ UNW_AARCH64_PC = 32,
+
// reserved block
- UNW_ARM64_D0 = 64,
- UNW_ARM64_D1 = 65,
- UNW_ARM64_D2 = 66,
- UNW_ARM64_D3 = 67,
- UNW_ARM64_D4 = 68,
- UNW_ARM64_D5 = 69,
- UNW_ARM64_D6 = 70,
- UNW_ARM64_D7 = 71,
- UNW_ARM64_D8 = 72,
- UNW_ARM64_D9 = 73,
- UNW_ARM64_D10 = 74,
- UNW_ARM64_D11 = 75,
- UNW_ARM64_D12 = 76,
- UNW_ARM64_D13 = 77,
- UNW_ARM64_D14 = 78,
- UNW_ARM64_D15 = 79,
- UNW_ARM64_D16 = 80,
- UNW_ARM64_D17 = 81,
- UNW_ARM64_D18 = 82,
- UNW_ARM64_D19 = 83,
- UNW_ARM64_D20 = 84,
- UNW_ARM64_D21 = 85,
- UNW_ARM64_D22 = 86,
- UNW_ARM64_D23 = 87,
- UNW_ARM64_D24 = 88,
- UNW_ARM64_D25 = 89,
- UNW_ARM64_D26 = 90,
- UNW_ARM64_D27 = 91,
- UNW_ARM64_D28 = 92,
- UNW_ARM64_D29 = 93,
- UNW_ARM64_D30 = 94,
- UNW_ARM64_D31 = 95,
+ UNW_AARCH64_RA_SIGN_STATE = 34,
+
+ // FP/vector registers
+ UNW_AARCH64_V0 = 64,
+ UNW_AARCH64_V1 = 65,
+ UNW_AARCH64_V2 = 66,
+ UNW_AARCH64_V3 = 67,
+ UNW_AARCH64_V4 = 68,
+ UNW_AARCH64_V5 = 69,
+ UNW_AARCH64_V6 = 70,
+ UNW_AARCH64_V7 = 71,
+ UNW_AARCH64_V8 = 72,
+ UNW_AARCH64_V9 = 73,
+ UNW_AARCH64_V10 = 74,
+ UNW_AARCH64_V11 = 75,
+ UNW_AARCH64_V12 = 76,
+ UNW_AARCH64_V13 = 77,
+ UNW_AARCH64_V14 = 78,
+ UNW_AARCH64_V15 = 79,
+ UNW_AARCH64_V16 = 80,
+ UNW_AARCH64_V17 = 81,
+ UNW_AARCH64_V18 = 82,
+ UNW_AARCH64_V19 = 83,
+ UNW_AARCH64_V20 = 84,
+ UNW_AARCH64_V21 = 85,
+ UNW_AARCH64_V22 = 86,
+ UNW_AARCH64_V23 = 87,
+ UNW_AARCH64_V24 = 88,
+ UNW_AARCH64_V25 = 89,
+ UNW_AARCH64_V26 = 90,
+ UNW_AARCH64_V27 = 91,
+ UNW_AARCH64_V28 = 92,
+ UNW_AARCH64_V29 = 93,
+ UNW_AARCH64_V30 = 94,
+ UNW_AARCH64_V31 = 95,
+
+ // Compatibility aliases
+ UNW_ARM64_X0 = UNW_AARCH64_X0,
+ UNW_ARM64_X1 = UNW_AARCH64_X1,
+ UNW_ARM64_X2 = UNW_AARCH64_X2,
+ UNW_ARM64_X3 = UNW_AARCH64_X3,
+ UNW_ARM64_X4 = UNW_AARCH64_X4,
+ UNW_ARM64_X5 = UNW_AARCH64_X5,
+ UNW_ARM64_X6 = UNW_AARCH64_X6,
+ UNW_ARM64_X7 = UNW_AARCH64_X7,
+ UNW_ARM64_X8 = UNW_AARCH64_X8,
+ UNW_ARM64_X9 = UNW_AARCH64_X9,
+ UNW_ARM64_X10 = UNW_AARCH64_X10,
+ UNW_ARM64_X11 = UNW_AARCH64_X11,
+ UNW_ARM64_X12 = UNW_AARCH64_X12,
+ UNW_ARM64_X13 = UNW_AARCH64_X13,
+ UNW_ARM64_X14 = UNW_AARCH64_X14,
+ UNW_ARM64_X15 = UNW_AARCH64_X15,
+ UNW_ARM64_X16 = UNW_AARCH64_X16,
+ UNW_ARM64_X17 = UNW_AARCH64_X17,
+ UNW_ARM64_X18 = UNW_AARCH64_X18,
+ UNW_ARM64_X19 = UNW_AARCH64_X19,
+ UNW_ARM64_X20 = UNW_AARCH64_X20,
+ UNW_ARM64_X21 = UNW_AARCH64_X21,
+ UNW_ARM64_X22 = UNW_AARCH64_X22,
+ UNW_ARM64_X23 = UNW_AARCH64_X23,
+ UNW_ARM64_X24 = UNW_AARCH64_X24,
+ UNW_ARM64_X25 = UNW_AARCH64_X25,
+ UNW_ARM64_X26 = UNW_AARCH64_X26,
+ UNW_ARM64_X27 = UNW_AARCH64_X27,
+ UNW_ARM64_X28 = UNW_AARCH64_X28,
+ UNW_ARM64_X29 = UNW_AARCH64_X29,
+ UNW_ARM64_FP = UNW_AARCH64_FP,
+ UNW_ARM64_X30 = UNW_AARCH64_X30,
+ UNW_ARM64_LR = UNW_AARCH64_LR,
+ UNW_ARM64_X31 = UNW_AARCH64_X31,
+ UNW_ARM64_SP = UNW_AARCH64_SP,
+ UNW_ARM64_PC = UNW_AARCH64_PC,
+ UNW_ARM64_RA_SIGN_STATE = UNW_AARCH64_RA_SIGN_STATE,
+ UNW_ARM64_D0 = UNW_AARCH64_V0,
+ UNW_ARM64_D1 = UNW_AARCH64_V1,
+ UNW_ARM64_D2 = UNW_AARCH64_V2,
+ UNW_ARM64_D3 = UNW_AARCH64_V3,
+ UNW_ARM64_D4 = UNW_AARCH64_V4,
+ UNW_ARM64_D5 = UNW_AARCH64_V5,
+ UNW_ARM64_D6 = UNW_AARCH64_V6,
+ UNW_ARM64_D7 = UNW_AARCH64_V7,
+ UNW_ARM64_D8 = UNW_AARCH64_V8,
+ UNW_ARM64_D9 = UNW_AARCH64_V9,
+ UNW_ARM64_D10 = UNW_AARCH64_V10,
+ UNW_ARM64_D11 = UNW_AARCH64_V11,
+ UNW_ARM64_D12 = UNW_AARCH64_V12,
+ UNW_ARM64_D13 = UNW_AARCH64_V13,
+ UNW_ARM64_D14 = UNW_AARCH64_V14,
+ UNW_ARM64_D15 = UNW_AARCH64_V15,
+ UNW_ARM64_D16 = UNW_AARCH64_V16,
+ UNW_ARM64_D17 = UNW_AARCH64_V17,
+ UNW_ARM64_D18 = UNW_AARCH64_V18,
+ UNW_ARM64_D19 = UNW_AARCH64_V19,
+ UNW_ARM64_D20 = UNW_AARCH64_V20,
+ UNW_ARM64_D21 = UNW_AARCH64_V21,
+ UNW_ARM64_D22 = UNW_AARCH64_V22,
+ UNW_ARM64_D23 = UNW_AARCH64_V23,
+ UNW_ARM64_D24 = UNW_AARCH64_V24,
+ UNW_ARM64_D25 = UNW_AARCH64_V25,
+ UNW_ARM64_D26 = UNW_AARCH64_V26,
+ UNW_ARM64_D27 = UNW_AARCH64_V27,
+ UNW_ARM64_D28 = UNW_AARCH64_V28,
+ UNW_ARM64_D29 = UNW_AARCH64_V29,
+ UNW_ARM64_D30 = UNW_AARCH64_V30,
+ UNW_ARM64_D31 = UNW_AARCH64_V31,
};
// 32-bit ARM registers. Numbers match DWARF for ARM spec #3.1 Table 1.
@@ -645,7 +718,8 @@ enum {
UNW_ARM_WR14 = 126,
UNW_ARM_WR15 = 127,
// 128-133 -- SPSR, SPSR_{FIQ|IRQ|ABT|UND|SVC}
- // 134-143 -- Reserved
+ // 134-142 -- Reserved
+ UNW_ARM_RA_AUTH_CODE = 143,
// 144-150 -- R8_USR-R14_USR
// 151-157 -- R8_FIQ-R14_FIQ
// 158-159 -- R13_IRQ-R14_IRQ
diff --git a/lib/libunwind/include/mach-o/compact_unwind_encoding.h b/lib/libunwind/include/mach-o/compact_unwind_encoding.h
index 5301b1055e..68d562eec4 100644
--- a/lib/libunwind/include/mach-o/compact_unwind_encoding.h
+++ b/lib/libunwind/include/mach-o/compact_unwind_encoding.h
@@ -1,4 +1,4 @@
-//===------------------ mach-o/compact_unwind_encoding.h ------------------===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/lib/libunwind/include/unwind.h b/lib/libunwind/include/unwind.h
index 1d3444cd83..b8d6020a33 100644
--- a/lib/libunwind/include/unwind.h
+++ b/lib/libunwind/include/unwind.h
@@ -1,4 +1,4 @@
-//===------------------------------- unwind.h -----------------------------===//
+//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -56,211 +56,23 @@ typedef enum {
typedef struct _Unwind_Context _Unwind_Context; // opaque
#if defined(_LIBUNWIND_ARM_EHABI)
-typedef uint32_t _Unwind_State;
-
-static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0;
-static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1;
-static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2;
-static const _Unwind_State _US_ACTION_MASK = 3;
-/* Undocumented flag for force unwinding. */
-static const _Unwind_State _US_FORCE_UNWIND = 8;
-
-typedef uint32_t _Unwind_EHT_Header;
-
-struct _Unwind_Control_Block;
-typedef struct _Unwind_Control_Block _Unwind_Control_Block;
-typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */
-
-struct _Unwind_Control_Block {
- uint64_t exception_class;
- void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block*);
-
- /* Unwinder cache, private fields for the unwinder's use */
- struct {
- uint32_t reserved1; /* init reserved1 to 0, then don't touch */
- uint32_t reserved2;
- uint32_t reserved3;
- uint32_t reserved4;
- uint32_t reserved5;
- } unwinder_cache;
-
- /* Propagation barrier cache (valid after phase 1): */
- struct {
- uint32_t sp;
- uint32_t bitpattern[5];
- } barrier_cache;
-
- /* Cleanup cache (preserved over cleanup): */
- struct {
- uint32_t bitpattern[4];
- } cleanup_cache;
-
- /* Pr cache (for pr's benefit): */
- struct {
- uint32_t fnstart; /* function start address */
- _Unwind_EHT_Header* ehtp; /* pointer to EHT entry header word */
- uint32_t additional;
- uint32_t reserved1;
- } pr_cache;
-
- long long int :0; /* Enforce the 8-byte alignment */
-} __attribute__((__aligned__(8)));
-
-typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
- (_Unwind_State state,
- _Unwind_Exception* exceptionObject,
- struct _Unwind_Context* context);
-
-typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
- _Unwind_State state, _Unwind_Exception *exceptionObject,
- struct _Unwind_Context *context);
+#include "unwind_arm_ehabi.h"
#else
-struct _Unwind_Context; // opaque
-struct _Unwind_Exception; // forward declaration
-typedef struct _Unwind_Exception _Unwind_Exception;
-
-struct _Unwind_Exception {
- uint64_t exception_class;
- void (*exception_cleanup)(_Unwind_Reason_Code reason,
- _Unwind_Exception *exc);
-#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
- uintptr_t private_[6];
-#else
- uintptr_t private_1; // non-zero means forced unwind
- uintptr_t private_2; // holds sp that phase1 found for phase2 to use
+#include "unwind_itanium.h"
#endif
-#if __SIZEOF_POINTER__ == 4
- // The implementation of _Unwind_Exception uses an attribute mode on the
- // above fields which has the side effect of causing this whole struct to
- // round up to 32 bytes in size (48 with SEH). To be more explicit, we add
- // pad fields added for binary compatibility.
- uint32_t reserved[3];
-#endif
- // The Itanium ABI requires that _Unwind_Exception objects are "double-word
- // aligned". GCC has interpreted this to mean "use the maximum useful
- // alignment for the target"; so do we.
-} __attribute__((__aligned__));
typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
(int version,
_Unwind_Action actions,
- uint64_t exceptionClass,
+ _Unwind_Exception_Class exceptionClass,
_Unwind_Exception* exceptionObject,
struct _Unwind_Context* context,
- void* stop_parameter );
-
-typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
- int version, _Unwind_Action actions, uint64_t exceptionClass,
- _Unwind_Exception *exceptionObject, struct _Unwind_Context *context);
-#endif
+ void* stop_parameter);
#ifdef __cplusplus
extern "C" {
#endif
-//
-// The following are the base functions documented by the C++ ABI
-//
-#ifdef __USING_SJLJ_EXCEPTIONS__
-extern _Unwind_Reason_Code
- _Unwind_SjLj_RaiseException(_Unwind_Exception *exception_object);
-extern void _Unwind_SjLj_Resume(_Unwind_Exception *exception_object);
-#else
-extern _Unwind_Reason_Code
- _Unwind_RaiseException(_Unwind_Exception *exception_object);
-extern void _Unwind_Resume(_Unwind_Exception *exception_object);
-#endif
-extern void _Unwind_DeleteException(_Unwind_Exception *exception_object);
-
-#if defined(_LIBUNWIND_ARM_EHABI)
-typedef enum {
- _UVRSC_CORE = 0, /* integer register */
- _UVRSC_VFP = 1, /* vfp */
- _UVRSC_WMMXD = 3, /* Intel WMMX data register */
- _UVRSC_WMMXC = 4 /* Intel WMMX control register */
-} _Unwind_VRS_RegClass;
-
-typedef enum {
- _UVRSD_UINT32 = 0,
- _UVRSD_VFPX = 1,
- _UVRSD_UINT64 = 3,
- _UVRSD_FLOAT = 4,
- _UVRSD_DOUBLE = 5
-} _Unwind_VRS_DataRepresentation;
-
-typedef enum {
- _UVRSR_OK = 0,
- _UVRSR_NOT_IMPLEMENTED = 1,
- _UVRSR_FAILED = 2
-} _Unwind_VRS_Result;
-
-extern void _Unwind_Complete(_Unwind_Exception* exception_object);
-
-extern _Unwind_VRS_Result
-_Unwind_VRS_Get(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
- uint32_t regno, _Unwind_VRS_DataRepresentation representation,
- void *valuep);
-
-extern _Unwind_VRS_Result
-_Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
- uint32_t regno, _Unwind_VRS_DataRepresentation representation,
- void *valuep);
-
-extern _Unwind_VRS_Result
-_Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
- uint32_t discriminator,
- _Unwind_VRS_DataRepresentation representation);
-#endif
-
-#if !defined(_LIBUNWIND_ARM_EHABI)
-
-extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index);
-extern void _Unwind_SetGR(struct _Unwind_Context *context, int index,
- uintptr_t new_value);
-extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);
-extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);
-
-#else // defined(_LIBUNWIND_ARM_EHABI)
-
-#if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE)
-#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern
-#else
-#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 static __inline__
-#endif
-
-// These are de facto helper functions for ARM, which delegate the function
-// calls to _Unwind_VRS_Get/Set(). These are not a part of ARM EHABI
-// specification, thus these function MUST be inlined. Please don't replace
-// these with the "extern" function declaration; otherwise, the program
-// including this <unwind.h> header won't be ABI compatible and will result in
-// link error when we are linking the program with libgcc.
-
-_LIBUNWIND_EXPORT_UNWIND_LEVEL1
-uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index) {
- uintptr_t value = 0;
- _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);
- return value;
-}
-
-_LIBUNWIND_EXPORT_UNWIND_LEVEL1
-void _Unwind_SetGR(struct _Unwind_Context *context, int index,
- uintptr_t value) {
- _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);
-}
-
-_LIBUNWIND_EXPORT_UNWIND_LEVEL1
-uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
- // remove the thumb-bit before returning
- return _Unwind_GetGR(context, 15) & (~(uintptr_t)0x1);
-}
-
-_LIBUNWIND_EXPORT_UNWIND_LEVEL1
-void _Unwind_SetIP(struct _Unwind_Context *context, uintptr_t value) {
- uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);
- _Unwind_SetGR(context, 15, value | thumb_bit);
-}
-#endif // defined(_LIBUNWIND_ARM_EHABI)
-
extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
extern uintptr_t
_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
diff --git a/lib/libunwind/include/unwind_arm_ehabi.h b/lib/libunwind/include/unwind_arm_ehabi.h
new file mode 100644
index 0000000000..6277a1457f
--- /dev/null
+++ b/lib/libunwind/include/unwind_arm_ehabi.h
@@ -0,0 +1,170 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//
+// C++ ABI Level 1 ABI documented at:
+// https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __ARM_EHABI_UNWIND_H__
+#define __ARM_EHABI_UNWIND_H__
+
+typedef uint32_t _Unwind_State;
+
+static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0;
+static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1;
+static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2;
+static const _Unwind_State _US_ACTION_MASK = 3;
+/* Undocumented flag for force unwinding. */
+static const _Unwind_State _US_FORCE_UNWIND = 8;
+
+typedef uint32_t _Unwind_EHT_Header;
+
+struct _Unwind_Control_Block;
+typedef struct _Unwind_Control_Block _Unwind_Control_Block;
+#define _Unwind_Exception _Unwind_Control_Block /* Alias */
+typedef uint8_t _Unwind_Exception_Class[8];
+
+struct _Unwind_Control_Block {
+ _Unwind_Exception_Class exception_class;
+ void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block*);
+
+ /* Unwinder cache, private fields for the unwinder's use */
+ struct {
+ uint32_t reserved1; /* init reserved1 to 0, then don't touch */
+ uint32_t reserved2;
+ uint32_t reserved3;
+ uint32_t reserved4;
+ uint32_t reserved5;
+ } unwinder_cache;
+
+ /* Propagation barrier cache (valid after phase 1): */
+ struct {
+ uint32_t sp;
+ uint32_t bitpattern[5];
+ } barrier_cache;
+
+ /* Cleanup cache (preserved over cleanup): */
+ struct {
+ uint32_t bitpattern[4];
+ } cleanup_cache;
+
+ /* Pr cache (for pr's benefit): */
+ struct {
+ uint32_t fnstart; /* function start address */
+ _Unwind_EHT_Header* ehtp; /* pointer to EHT entry header word */
+ uint32_t additional;
+ uint32_t reserved1;
+ } pr_cache;
+
+ long long int :0; /* Enforce the 8-byte alignment */
+} __attribute__((__aligned__(8)));
+
+typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
+ _Unwind_State state, _Unwind_Exception *exceptionObject,
+ struct _Unwind_Context *context);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// The following are the base functions documented by the C++ ABI
+//
+#ifdef __USING_SJLJ_EXCEPTIONS__
+extern _Unwind_Reason_Code
+ _Unwind_SjLj_RaiseException(_Unwind_Exception *exception_object);
+extern void _Unwind_SjLj_Resume(_Unwind_Exception *exception_object);
+#else
+extern _Unwind_Reason_Code
+ _Unwind_RaiseException(_Unwind_Exception *exception_object);
+extern void _Unwind_Resume(_Unwind_Exception *exception_object);
+#endif
+extern void _Unwind_DeleteException(_Unwind_Exception *exception_object);
+
+typedef enum {
+ _UVRSC_CORE = 0, /* integer register */
+ _UVRSC_VFP = 1, /* vfp */
+ _UVRSC_WMMXD = 3, /* Intel WMMX data register */
+ _UVRSC_WMMXC = 4, /* Intel WMMX control register */
+ _UVRSC_PSEUDO = 5 /* Special purpose pseudo register */
+} _Unwind_VRS_RegClass;
+
+typedef enum {
+ _UVRSD_UINT32 = 0,
+ _UVRSD_VFPX = 1,
+ _UVRSD_UINT64 = 3,
+ _UVRSD_FLOAT = 4,
+ _UVRSD_DOUBLE = 5
+} _Unwind_VRS_DataRepresentation;
+
+typedef enum {
+ _UVRSR_OK = 0,
+ _UVRSR_NOT_IMPLEMENTED = 1,
+ _UVRSR_FAILED = 2
+} _Unwind_VRS_Result;
+
+extern void _Unwind_Complete(_Unwind_Exception* exception_object);
+
+extern _Unwind_VRS_Result
+_Unwind_VRS_Get(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
+ uint32_t regno, _Unwind_VRS_DataRepresentation representation,
+ void *valuep);
+
+extern _Unwind_VRS_Result
+_Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
+ uint32_t regno, _Unwind_VRS_DataRepresentation representation,
+ void *valuep);
+
+extern _Unwind_VRS_Result
+_Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
+ uint32_t discriminator,
+ _Unwind_VRS_DataRepresentation representation);
+
+#if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE)
+#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern
+#else
+#define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 static __inline__
+#endif
+
+// These are de facto helper functions for ARM, which delegate the function
+// calls to _Unwind_VRS_Get/Set(). These are not a part of ARM EHABI
+// specification, thus these function MUST be inlined. Please don't replace
+// these with the "extern" function declaration; otherwise, the program
+// including this <unwind.h> header won't be ABI compatible and will result in
+// link error when we are linking the program with libgcc.
+
+_LIBUNWIND_EXPORT_UNWIND_LEVEL1
+uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index) {
+ uintptr_t value = 0;
+ _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);
+ return value;
+}
+
+_LIBUNWIND_EXPORT_UNWIND_LEVEL1
+void _Unwind_SetGR(struct _Unwind_Context *context, int index,
+ uintptr_t value) {
+ _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);
+}
+
+_LIBUNWIND_EXPORT_UNWIND_LEVEL1
+uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
+ // remove the thumb-bit before returning
+ return _Unwind_GetGR(context, 15) & (~(uintptr_t)0x1);
+}
+
+_LIBUNWIND_EXPORT_UNWIND_LEVEL1
+void _Unwind_SetIP(struct _Unwind_Context *context, uintptr_t value) {
+ uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);
+ _Unwind_SetGR(context, 15, value | thumb_bit);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ARM_EHABI_UNWIND_H__
diff --git a/lib/libunwind/include/unwind_itanium.h b/lib/libunwind/include/unwind_itanium.h
new file mode 100644
index 0000000000..d94a6183be
--- /dev/null
+++ b/lib/libunwind/include/unwind_itanium.h
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//
+// C++ ABI Level 1 ABI documented at:
+// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __ITANIUM_UNWIND_H__
+#define __ITANIUM_UNWIND_H__
+
+struct _Unwind_Context; // opaque
+struct _Unwind_Exception; // forward declaration
+typedef struct _Unwind_Exception _Unwind_Exception;
+typedef uint64_t _Unwind_Exception_Class;
+
+struct _Unwind_Exception {
+ _Unwind_Exception_Class exception_class;
+ void (*exception_cleanup)(_Unwind_Reason_Code reason,
+ _Unwind_Exception *exc);
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+ uintptr_t private_[6];
+#else
+ uintptr_t private_1; // non-zero means forced unwind
+ uintptr_t private_2; // holds sp that phase1 found for phase2 to use
+#endif
+#if __SIZEOF_POINTER__ == 4
+ // The implementation of _Unwind_Exception uses an attribute mode on the
+ // above fields which has the side effect of causing this whole struct to
+ // round up to 32 bytes in size (48 with SEH). To be more explicit, we add
+ // pad fields added for binary compatibility.
+ uint32_t reserved[3];
+#endif
+ // The Itanium ABI requires that _Unwind_Exception objects are "double-word
+ // aligned". GCC has interpreted this to mean "use the maximum useful
+ // alignment for the target"; so do we.
+} __attribute__((__aligned__));
+
+typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
+ int version, _Unwind_Action actions, uint64_t exceptionClass,
+ _Unwind_Exception *exceptionObject, struct _Unwind_Context *context);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// The following are the base functions documented by the C++ ABI
+//
+#ifdef __USING_SJLJ_EXCEPTIONS__
+extern _Unwind_Reason_Code
+ _Unwind_SjLj_RaiseException(_Unwind_Exception *exception_object);
+extern void _Unwind_SjLj_Resume(_Unwind_Exception *exception_object);
+#else
+extern _Unwind_Reason_Code
+ _Unwind_RaiseException(_Unwind_Exception *exception_object);
+extern void _Unwind_Resume(_Unwind_Exception *exception_object);
+#endif
+extern void _Unwind_DeleteException(_Unwind_Exception *exception_object);
+
+
+extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index);
+extern void _Unwind_SetGR(struct _Unwind_Context *context, int index,
+ uintptr_t new_value);
+extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);
+extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ITANIUM_UNWIND_H__