-
Notifications
You must be signed in to change notification settings - Fork 343
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
Allow foreign rust functions #1170
Comments
It is probably possible, yes. But I do not know the best way to implement this -- somehow, Miri would have to find the function with a given extern name. |
Even though I think this is possible, how do we guarantee that allowing to execute extern code would not compromise miri's capability of detecting UB? |
It's not actually extern code. The implementation is Rust code as well so we just go on interpreting. |
I have absolutely no idea whether this is the right thing, but we may be able to just iterate over all crates and call https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/query/struct.TyCtxtAt.html#method.exported_symbols in order to collect the name -> DefId map and continue interpretation at the new def ID. An extern other than "Rust" should also emit an error if unwinding happens across that boundary |
I have a similar related question -- will it be possible to allow Miri evaluate foreign statics?
|
I'm afraid the question is not very related at all. The issue here is specifically about calling We already emulate one foreign static, and support for others can be added. But this is like function shims: you need to actually write the code that implements whatever interaction with that foreign static would happen in real code. If you have s specific well-known foreign static that you think should be supported, please open a new issue (just like we have issues to support calling specific foreign functions). For general support for arbitrary foreign statics, I don't even know what that would mean (should Miri just guess their value...?!?), but it seems related to general FFI support so that would be #11. |
Thanks, yes, #11 is indeed more relevant. |
Hi,
Is it possible to allow miri to evaluate foreign calls to rust functions?
Example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3cddf97b737ae015f92093c9bab2461e
The text was updated successfully, but these errors were encountered: