-
Notifications
You must be signed in to change notification settings - Fork 352
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
Support getentropy on macOS as a foreign item #3098
Conversation
src/shims/rand.rs
Outdated
|
||
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {} | ||
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { | ||
fn getentropy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to macos/foreign_items
and call it from dlsym
. It is macos-specific and should live in the macos module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I can do that. I was following the pattern of mach_timebase_info
but I guess there's not enough in this file for it to be worth existing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah for time we have all the shims for all OSes in one file. Those are old shims, we've been adjusting and organizing them differently more recently. (Also, following that pattern would mean putting all getrandom shims for all OSes into shims/rand.v
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty, its been moved to the macOS-specific module.
a24506e
to
b84e7b7
Compare
As mentioned in the other PR, you can do the Miri changes right then and there. I think that would be preferable -- you can then entirely remove the dlsym, supporting only the direct-linking case, and we can avoid having a shim that is not being tested. |
Ah never mind, |
I'm good with moving the changes over there though since that appears easier for both of us. If you think what is in this branch right now is fine I'll close this PR and cherry-pick it over to |
Right, the concern about tests was that the new shim (not via dlsym) is untested now. But I guess it will be tested soon and anyway it shares the code with the dlsym shim that we do test, so... @bors r+ |
☀️ Test successful - checks-actions |
Prior this was always assumed to be accessed via
dlsym
shim, but instd
I'm attempting to start unconditionally linking togetentropy
on macOS now that Rust's platform version support allows it.This just moves the main logic of the previous
dlsym
handler into an eval context extension so it can be used via both call paths. Thedlsym
handler is still needed asgetrandom
uses it.