Skip to content

Add support for setting dynamically available target features #3100

Open
@RalfJung

Description

@RalfJung

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-interpreterArea: affects the core interpreterC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions