On Sat May 17 15:59:50 2025 +0000, Alexandre Julliard wrote:
Thanks. Ultimately we probably want a compiler check instead of having to explicitly pass `-DUSE_COMPILER_EXCEPTIONS`, but let's see how it goes first.
I took a closer look and managed to get it working without requiring LLVM changes. The original issue can be worked around by using `-fasync-exceptions` (which corresponds to `/EHa` in MSVC). This shouldn't be necessary for `__try`/`__except`, so it's an LLVM bug. However, using this flag should be fine for Wine, so we don't need to wait for an upstream fix.
With that workaround, Clang appears to generate reasonable code, but it runs into a Wine-side bug in exception handling: `_exception_code` inside a `__except` block expects the code to be passed in `eax`. The [attached WIP patch](/uploads/2c0482eee91670e21d7d7a533dd302e8/wip.diff) addresses this and gets things working. I still need to do more testing to confirm the approach is correct, so feedback is welcome.
Since we’re closer to a proper solution than I originally thought, I will drop the last commit from this MR. We might as well aim to get it right from the start.