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

Add support for setting dynamically available target features #3100

Open
RalfJung opened this issue Oct 2, 2023 · 0 comments
Open

Add support for setting dynamically available target features #3100

RalfJung opened this issue Oct 2, 2023 · 0 comments
Labels
A-interpreter Area: affects the core interpreter C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@RalfJung
Copy link
Member

RalfJung commented Oct 2, 2023

Currently one can tell Miri that, e.g., AVX is available by setting -C target-feature="avx". However, that corresponds to building a binary that statically requires AVX to be available. For real Rust, there's also the possibility of building code without AVX being globally available, but then at run-time detecting AVX to be available. It would be great if Miri could emulate that.

This will require at least:

  • Some way to set which features are dynamically available. Probably something like -Zmiri-target-feature.
  • Making sure that is_target_feature_enabled! respects this dynamic set.

The test added in #3099 can then be made more subtle by enabling AVX dynamically, at which point the currently reported UB should disappear -- but we should still see UB due to the ABI mismatch!

@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement A-interpreter Area: affects the core interpreter labels Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-interpreter Area: affects the core interpreter C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

1 participant