diff options
| author | Charles Davis <cdavis5x@gmail.com> | 2018-08-08 15:18:20 +0000 |
|---|---|---|
| committer | Charles Davis <cdavis5x@gmail.com> | 2018-08-08 15:18:20 +0000 |
| commit | 06acf1f638807ba9bb5037f66e275591add445c3 (patch) | |
| tree | 10bf8f19aa8bf55f59e1a18376bdd7d621f83791 /libunwind/include | |
| parent | 52f3631f4b707df999371dad04b069fea6178820 (diff) | |
| download | bcm5719-llvm-06acf1f638807ba9bb5037f66e275591add445c3.tar.gz bcm5719-llvm-06acf1f638807ba9bb5037f66e275591add445c3.zip | |
[libunwind][include] Add SEH declarations to <unwind.h>.
Summary:
Make the `_Unwind_Exception` struct correct under SEH. Add a
declaration of `_GCC_specific_handler()`, which is used by SEH versions
of Itanium personality handlers to do common setup. Roughly corresponds
to Clang's D50380.
Reviewers: mstorsjo, rnk, compnerd, smeenai
Subscribers: christof, chrib, cfe-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D50414
llvm-svn: 339258
Diffstat (limited to 'libunwind/include')
| -rw-r--r-- | libunwind/include/unwind.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/libunwind/include/unwind.h b/libunwind/include/unwind.h index 0ab87dd615b..c24d6ab313b 100644 --- a/libunwind/include/unwind.h +++ b/libunwind/include/unwind.h @@ -19,6 +19,10 @@ #include <stdint.h> #include <stddef.h> +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#include <windows.h> +#endif + #if defined(__APPLE__) #define LIBUNWIND_UNAVAIL __attribute__ (( unavailable )) #else @@ -120,13 +124,17 @@ 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 +#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. To be more explicit, we add pad fields - // added for binary compatibility. + // 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 @@ -369,6 +377,24 @@ extern void *__deregister_frame_info(const void *fde) extern void *__deregister_frame_info_bases(const void *fde) LIBUNWIND_UNAVAIL; +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +// This is the common wrapper for GCC-style personality functions with SEH. +#ifdef __x86_64__ +// The DISPATCHER_CONTEXT struct is only defined on x64. +extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc, + PVOID frame, + PCONTEXT ctx, + PDISPATCHER_CONTEXT disp, + _Unwind_Personality_Fn pers); +#else +extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc, + PVOID frame, + PCONTEXT ctx, + PVOID disp, + _Unwind_Personality_Fn pers); +#endif +#endif + #ifdef __cplusplus } #endif |

