-
Notifications
You must be signed in to change notification settings - Fork 289
Run-time feature detection for Aarch64 on Windows. #829
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
crates/std_detect/Cargo.toml
Outdated
@@ -25,6 +25,9 @@ maintenance = { status = "experimental" } | |||
libc = { version = "0.2", optional = true, default-features = false } | |||
cfg-if = "0.1.10" | |||
|
|||
[target.'cfg(target_os="windows")'.dependencies] |
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.
[target.'cfg(target_os="windows")'.dependencies] | |
[target.'cfg(all(target_os = "windows", target_arch = "aarch64"))'.dependencies] |
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.
Beyond the Cargo.toml nitpick this looks fine to me.
I don't know how complex the implementation of the FFI wrappers for this API is in winapi, but it might speed things up to remove the winapi dependency for now, and re-implementing it ourselves here.
We can then remove that and move towards using winapi in libstd as part of a future refactoring, that only needs to deal with the "organizational" issues of adding a new dependency to the Rust language runtime.
EDIT: the winapi wrapper without the definitions looks quite simple, and we only need to make sure this works for the aarch64 target, so it might be worth it to just copy paste what we need: https://github.com/retep998/winapi-rs/blob/a6dd5510212a2f0f5aae66e60949bd6fdaa0a44d/src/um/processthreadsapi.rs#L337
If I shouldn't use winapi, I remove this, then I add FFI to call Win32 API without winapi. |
I think this feature is important, and removing winapi would definitely help landing this faster. After this has landed on rust-lang/rust, you can submit another PR that changes this to use winapi, and we can slowly work out through all organizational issues - that would usually take on the order of weeks if an FCP turns out to be required. |
1f19317
to
c8204ec
Compare
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.
Modulo nitpicks, this looks great!
c8204ec
to
6cc928e
Compare
Thank you! |
Windows has API to detect CPU features for crc32 and ARM crypto extension.