-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding LLVM/Clang support #9
Comments
This would be a great addition, considering that in the future I would like to explore some way to support exception handling with Posix signals. MicroSEH could become the only library needed for HW exception handling in Rust, on all the compilers and major OSes. |
Good news from the GCC repos. Seems like both GCC and LLVM support it for at least x86_64 in their standard platform-specific unwind mechanics! At least up to a certain point, but that should also mean they provide the required entries in headers to register our own handler functions. Do note, though, that "handling" some of these exceptions does not mean the environment is still in a consistent or workable state; so perhaps add a warning to the docs that some should just mean graceful teardown and exit rather than recovery. As for Windows Services, SEH is used for some signaling as well. Including the kind that tells you that your process is about to get nuked. I think it's reasonable for a crate like this to support only the common use case - that is, for embedded someone will want a much more specific solution and for any desktop/server workload it's reasonable to assume people aren't using 32-bit architectures and OSes anymore |
I completely agree, this library was originally just meant to be for Win-MSVC-x64 but I'm okay with adding support for multiple architectures and compilers, as long as they don't require too much effort! |
is there any possibility for adding support of |
I think I have seen something about gcc having __try1 and __except1, but honestly I have very little experience with GCC, especially on Windows |
The |
That's interesting. The main reason I went with wrapping the MSVC SEH implementation was to quickly have support for all the archs supported by Windows. Writing the handler registration ourselves would also make many of the docsrs build.rs issues we had disappear. |
Writing handler registration manually is a lot of work and we'd be stuck manually writing them for every supported exception type. And then we'd be doing this once for every thread (though if we do that inside Though if we can assume these exceptions don't come from the calling and handler-registering frame, which should be the case here because we very explicitly register before doing anything, then LLVM seems to support all we need out of the box already! So we should be able to call the LLVM toolchain for this as well, with |
So it seems like LLVM supports SEH for both i686 and x86_64 which might even allow for enabling this for use with
windows-gnu
toolchains, probably by setting the compiler used asclang
and linking their libc and libunwind.I'll do some more digging and experimenting soon and PR if and when I get it to work in the hopes we can get SEH support across toolchains. Some searching does make it seem like GCC has support for at least x86_64 SEH and with the relevant Borland patents for it having expired, we might yet see i686 support as well there!
The text was updated successfully, but these errors were encountered: