diff options
| author | Charles Davis <cdavis5x@gmail.com> | 2018-08-30 21:29:00 +0000 |
|---|---|---|
| committer | Charles Davis <cdavis5x@gmail.com> | 2018-08-30 21:29:00 +0000 |
| commit | a7e3a6d8029dc16a3d91eeaf54e9e74ad56ad177 (patch) | |
| tree | 7c0f18ea8a9ee4cdc452d6dbe0dd4b4272125133 /libunwind/include | |
| parent | c11a780ed65a4e11c6bee68f7fd349c611f2fe18 (diff) | |
| download | bcm5719-llvm-a7e3a6d8029dc16a3d91eeaf54e9e74ad56ad177.tar.gz bcm5719-llvm-a7e3a6d8029dc16a3d91eeaf54e9e74ad56ad177.zip | |
Add support for SEH unwinding on Windows.
Summary:
I've tested this implementation on x86-64 to ensure that it works. All
`libc++abi` tests pass, as do all `libc++` exception-related tests. ARM
still remains to be implemented (@compnerd?).
Special thanks to KJK::Hyperion for his excellent series of articles on
how EH works on x86-64 Windows. (Seriously, check it out. It's awesome.)
I'm actually not sure if this should go in as is. I particularly don't
like that I duplicated the UnwindCursor class for this special case.
Reviewers: mstorsjo, rnk, compnerd, smeenai, javed.absar
Subscribers: mgorny, kristof.beyls, christof, chrib, cfe-commits, compnerd, llvm-commits
Differential Revision: https://reviews.llvm.org/D50564
llvm-svn: 341125
Diffstat (limited to 'libunwind/include')
| -rw-r--r-- | libunwind/include/__libunwind_config.h | 11 | ||||
| -rw-r--r-- | libunwind/include/unwind.h | 20 |
2 files changed, 23 insertions, 8 deletions
diff --git a/libunwind/include/__libunwind_config.h b/libunwind/include/__libunwind_config.h index 5464e367060..0704946d30a 100644 --- a/libunwind/include/__libunwind_config.h +++ b/libunwind/include/__libunwind_config.h @@ -34,7 +34,11 @@ # define _LIBUNWIND_TARGET_X86_64 1 # if defined(_WIN64) # define _LIBUNWIND_CONTEXT_SIZE 54 -# define _LIBUNWIND_CURSOR_SIZE 66 +# ifdef __SEH__ +# define _LIBUNWIND_CURSOR_SIZE 204 +# else +# define _LIBUNWIND_CURSOR_SIZE 66 +# endif # else # define _LIBUNWIND_CONTEXT_SIZE 21 # define _LIBUNWIND_CURSOR_SIZE 33 @@ -57,7 +61,10 @@ # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 # elif defined(__arm__) # define _LIBUNWIND_TARGET_ARM 1 -# if defined(__ARM_WMMX) +# if defined(__SEH__) +# define _LIBUNWIND_CONTEXT_SIZE 42 +# define _LIBUNWIND_CURSOR_SIZE 85 +# elif defined(__ARM_WMMX) # define _LIBUNWIND_CONTEXT_SIZE 61 # define _LIBUNWIND_CURSOR_SIZE 68 # else diff --git a/libunwind/include/unwind.h b/libunwind/include/unwind.h index 05f5a16b825..ae8ae5d24ed 100644 --- a/libunwind/include/unwind.h +++ b/libunwind/include/unwind.h @@ -19,8 +19,9 @@ #include <stdint.h> #include <stddef.h> -#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) && defined(_WIN32) #include <windows.h> +#include <ntverp.h> #endif #if defined(__APPLE__) @@ -378,12 +379,19 @@ extern void *__deregister_frame_info_bases(const void *fde) LIBUNWIND_UNAVAIL; #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#ifndef _WIN32 +typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD; +typedef struct _CONTEXT CONTEXT; +typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; +#elif !defined(__MINGW32__) && VER_PRODUCTBUILD < 8000 +typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; +#endif // This is the common wrapper for GCC-style personality functions with SEH. -extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD exc, - PVOID frame, - PCONTEXT ctx, - PDISPATCHER_CONTEXT disp, - _Unwind_Personality_Fn pers); +extern EXCEPTION_DISPOSITION _GCC_specific_handler(EXCEPTION_RECORD *exc, + void *frame, + CONTEXT *ctx, + DISPATCHER_CONTEXT *disp, + __personality_routine pers); #endif #ifdef __cplusplus |

