Hi
I've got a working build of mingw64-rust [1] with which I'm able to
successfully build a current version of mingw64-librsvg2. But here comes
the problem: As explained here [2], rust cannot be cross-compiled to a
mingw32 target using SJLJ exceptions. To be able to offer mingw-rust in
the main repos, I don't see many other options than switching the
mingw32 toolchain to dwarf2 exceptions if we want to keep the same
package set for both mingw32 and mingw64.
As far as I can see, there are some (rather old) discussions here and
there concerning which model to use, i.e. this one for debian [3] and
this one for mingw-w64 [4]. All in all, the summary appears to be
SJLJ (setjmp/longjmp):
- not "zero-cost": even if an exception isn't thrown, it incurs a minor
performance penalty (~15% in exception heavy code)
- allows exceptions to traverse through e.g. windows callbacks
DWARF (DW2, dwarf-2)
- no permanent runtime overhead
- needs whole call stack to be dwarf-enabled, which means exceptions
cannot be thrown over e.g. Windows system DLLs (i.e. throwing an
exception in a system DLL callback and attempting to catch it won't work)
- DW2 potentially generates bigger libraries. The overhead however is
not big (< 10%) for typical applications.
MSYS2 for one appears to have switched to DW2 [5].
Any opinions whether we should also switch to dwarf2? Or how to handle
the mingw-rust situation in general?
Thanks
Sandro
[1]
https://copr.fedorainfracloud.org/coprs/smani/mingw64-rust/builds/
[2]
https://github.com/rust-lang/rust/issues/12859
[3]
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540782
[4]
https://sourceforge.net/p/mingw-w64/mailman/message/30532139/
[5]
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-gcc/PKGBUIL...