[cfe-dev] LLVM/Clang and setjmp/longjmp exception handling on MinGW

David Chisnall csdavec at swan.ac.uk
Tue Nov 1 05:50:41 PDT 2011


On 1 Nov 2011, at 10:19, Ruben Van Boxem wrote:

> GCC doesn't have any Dwarf exception handling on 64-bit Windows, due to it being either extremely hard or impossible to get right. I would like to get Clang to produce working exception code for Windows. The "right way" is patented (SEH)

Nope.  SEH is not the right way of implementing exceptions on Win64 (it's not really the right way of implementing C++ exceptions on Win32 either).  The right way is to use the Win64 exception ABI:

http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx

This is not patented, and is fairly similar to the DWARF zero-cost model, just with (in typical Microsoft fashion) different layouts for everything.  The exception model in LLVM IR would map very cleanly to this, but (as far as I know) no one is working on it yet.  It would be possible to use the same LSDA format as on other platforms, and just provide a struct UNWIND_INFO for each function pointing to this, with fairly minimal changes to the personality function.  I'd be happy to make these changes in libcxxrt...

David




More information about the cfe-dev mailing list