Thread overview
Win64 exception support?
Feb 10, 2013
kinke
Feb 10, 2013
David Nadlinger
Feb 11, 2013
Kai Nacke
Feb 16, 2013
Kai Nacke
February 10, 2013
Hey guys,

what's currently missing for working exception handling under Win64?
https://github.com/ldc-developers/ldc/issues/166 suggests LLVM 3.3 provides at least preliminary support. What else do we need? I'd like to help, but I need some hints...

Thanks and keep it up!
February 10, 2013
On Sunday, 10 February 2013 at 22:16:17 UTC, kinke wrote:
> https://github.com/ldc-developers/ldc/issues/166 suggests LLVM 3.3 provides at least preliminary support. What else do we need? I'd like to help, but I need some hints...

As far as I know (I haven't really been following the llvm-commits list lately), the only thing that already made its way into the LLVM SVN is the part of the patch that adds support for the exception tables to the COFF file dumping tool.

I think Kai also did some work on the other parts of the patches that have been posted to the mailing list (linked in #166), but I don't know if he has been able to make much progress yet.

David
February 11, 2013
On Sunday, 10 February 2013 at 22:16:17 UTC, kinke wrote:
> Hey guys,
>
> what's currently missing for working exception handling under Win64?
> https://github.com/ldc-developers/ldc/issues/166 suggests LLVM 3.3 provides at least preliminary support. What else do we need? I'd like to help, but I need some hints...
>
> Thanks and keep it up!

The code to generate the EH data is linked to the issue. (Just give me a hint if you can't apply it cleanly. I update the patch then.)

There are (at least!) 2 bugs left:
- the EH personality function is hard coded. IMHO this is easy to change.
- the code generated by LLVM does not always conform to the WinABI

The last point is serious. E.g. the WinABI states that all integers are passed as 64-bit values and expect that the whole 64-bit register is saved on the stack. In contrast, LLVM reserves and stores only 32-bit values for 32-bit wide parameters. This breaks the EH data generation.

Is these problems are solved then the implementation in druntime is still missing. Again, this should be easy and simply following the Dwarf EH solution from Linux.

Regards
Kai
February 16, 2013
You could also try to get Setjmp/Longjmp exception handling to work. This would have the benefit to work in 32 bit mode, too.
That's not the best solution but my be easier to realize.

Regards
Kai