[PATCH] D50564: Add support for SEH unwinding on Windows.

Charles Davis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 14 10:27:56 PDT 2018


cdavis5x added a comment.

In https://reviews.llvm.org/D50564#1195985, @cdavis5x wrote:

> In https://reviews.llvm.org/D50564#1195794, @mstorsjo wrote:
>
> > > 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.)
> >
> > Can you give some links to it? A brief googling didn't turn up much else than the PSEH library.
>
>
> I can't seem to find it either. I wonder if it's vanished from the Internet. Maybe the IA will have something.


Found it: http://www.nynaeve.net/?p=99. Interestingly, a reference to that was in the MinGW headers--I think that's how I found it in the first place. I'll update the description.

In https://reviews.llvm.org/D50564#1199311, @zturner wrote:

> In https://reviews.llvm.org/D50564#1199285, @rnk wrote:
>
> > In https://reviews.llvm.org/D50564#1198996, @cdavis5x wrote:
> >
> > > Could somebody verify that the `DISPATCHER_CONTEXT` struct is defined in `<winnt.h>` for the Win8 and Win10 SDKs? I can't install them right now.
> >
> >
> > I checked both, and they are available, so I think we should guard the definition like this:
> >
> >   // Provide a definition for _DISPATCHER_CONTEXT for Win7 and earlier SDK versions.
> >   // Mingw64 has always provided this struct.
> >   #if defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && !defined(__MINGW64__) && defined(WINVER) && WINVER < _WIN32_WINNT_WIN8
> >   # if defined(__x86_64__)
> >   typedef struct _DISPATCHER_CONTEXT { ... } DISPATCHER_CONTEXT;
> >   # elif defined(__arm__)
> >   typedef struct _DISPATCHER_CONTEXT { ... } DISPATCHER_CONTEXT;
> >   # endif
> >   #endif
> >
> >
> > Does that seem right? I'm not super familiar with SDK version detection, so I might have the wrong macros.
>
>
> I believe you need to check `VER_PRODUCTBUILD` from `<ntverp.h>` if you are looking for the version of the Windows SDK that is being used to build the current application.


Thanks, @rnk and @zturner.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D50564





More information about the cfe-commits mailing list