Skip to content
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

Load weak dll imports on Windows #1707

Closed
m-ou-se opened this issue Feb 13, 2021 · 5 comments
Closed

Load weak dll imports on Windows #1707

m-ou-se opened this issue Feb 13, 2021 · 5 comments
Labels
A-shims Area: This affects the external function shims A-windows Area: affects only Windows targets C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@m-ou-se
Copy link
Member

m-ou-se commented Feb 13, 2021

On Windows, some syscalls (e.g. WakeOnAddress) are loaded from an .CRT$XCU section, which doesn't get executed on Miri.

See rust-lang/rust#81478 (comment)

This means the standard library falls back to not using those, which is okay for now, but is a problem when implementing WakeOnAddress, as that mechanism falls back to another dynamic dll import which will also not have been loaded in miri.

@RalfJung
Copy link
Member

So basically, #450 will be mandatory on Windows for things like WakeOnAddress?

@RalfJung RalfJung added A-shims Area: This affects the external function shims A-windows Area: affects only Windows targets labels Feb 13, 2021
@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 13, 2021

With the current implementation in std, yes. But there's big plans for changes that area: rust-lang/rust#81478 (comment)

@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 13, 2021

I suppose we could also add some #[cfg(miri)] in std to load these differently in miri?

@RalfJung
Copy link
Member

Yeah, that would be one option.

Implementing these sections also shouldn't be terribly hard -- we just need some way to iterate over all static that are declared to live in that section, and then run those function pointers. It's just a bit annoying to get the code flow right here (I think this needs to be a new "stage" or so in our scheduler).

@RalfJung RalfJung added the C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement label Feb 17, 2021
@RalfJung
Copy link
Member

RalfJung commented Apr 9, 2022

rust-lang/rust#95775 makes weak dll imports on Windows "work" in Miri via a hack (as already suggested above by @m-ou-se). Still, that's enough to close this issue I think. We have #450 for "properly" implementing this.

@RalfJung RalfJung closed this as completed Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-shims Area: This affects the external function shims A-windows Area: affects only Windows targets C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

2 participants