-
Notifications
You must be signed in to change notification settings - Fork 360
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
How to make Miri see symbols in a rust-based cdylib? #4165
Comments
All dependencies need to be compiled with MIR for all functions available in the crate metadata for miri to work. The cdylib crate type however doesn't generate any crate metadata at all (even |
I tried to detect if miri is present and change |
A Rust-based cdylib is indistinguishable from a C-based native library, so... no this does not work, unfortunately. You can try playing around with Miri's native FFI support (but note that sharing memory with the native library can miss UB and not all cases are supported). Making that more automatic is loosely tracked in #4077, though there are no concrete plans or even ideas at the moment. |
But Miri can see the definition of |
Miri can see everything in the current crate graph, that's why it can see I don't know if linking this as an rlib will suffice -- we do a whole lot of magic in |
That would be hopeless. It seems there is no way to add a rlib to the crate graph in a build script rust-lang/cargo#14065. What about |
Miri needs the MIR of that crate, loaded into the current rustc session. I don't think there is any way to do that without |
I have a binary crate with this
main.rs
:foo2
is defined in a normal cargo dependency, butfoo4
is defined in a filegav.rs
that I build by invoking rustc directly in the build script:Miri can find and execute the
foo2
, but notfoo4
. I believe if I call miri sufficiently close to how cargo calls it, it will work. What should I do to make it working?The text was updated successfully, but these errors were encountered: