<div class="gmail_quote">2011/11/1 David Chisnall <span dir="ltr"><<a href="mailto:csdavec@swan.ac.uk">csdavec@swan.ac.uk</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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:<br>
<br>
<a href="http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx</a><br>
<br>
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...<br></blockquote><br>
What about associated stack unwinding? I'm not quite familiar with all 
this, and am kind of going half-blind on anything Google pops up. I did 
take a look at the Win64 EH specification, but couldn't find the link to
 what's happening in libcxxrt. And libcxxrt depends on libunwind or 
similar, so that needs to be handled appropriately as well. I would very
 much appreciate if you could make those changes to libcxxrt, although 
I'm unsure if I'm able to do anything sensible here...<br>
<br>2011/11/1 NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com">geek4civic@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2011/11/1 Ruben Van Boxem <<a href="mailto:vanboxem.ruben@gmail.com">vanboxem.ruben@gmail.com</a>>:<br>
<div class="im">> GCC doesn't have any Dwarf exception handling on 64-bit Windows, due to it<br>
> being either extremely hard or impossible to get right. I would like to get<br>
> Clang to produce working exception code for Windows. The "right way" is<br>
> patented (SEH), so pretty of limits to anyone not from MS (or Borland, the<br>
> patent holder). I'm not trying to wake up this discussion again. I just want<br>
> to enable/implement/fix sjlj exception handling for Windows, in hopefully a<br>
> MinGW GCC compatible way.<br>
<br>
</div>As called the patent is Win32 x86 specific implementations, IANAL.<br>
<br>
Charles Davis had been working on implementing x64 EH. I don't know<br>
how they work.<br>
Ruben, I suppose Kai has been working for x64 EH, right?<br>
(it is dw2-like implementation, IIRC)<br>
<br>
Anyway, would you like us to implement sjlj on win32 x86?<br></blockquote><div><br>As it stands, Windows+Clang == no working exceptions, which... sucks. It would be nice to have a nasty sjlj fallback untill the "proper" solution arrives. I was trying to enable this for MinGW at least in Clang, but it seems adding a bool UseSjLjExceptions() const; to the Windows Toolchain that returns true isn't doing anything :(<br>
<br>Ruben<br></div></div>