Skip to content

"paca" and "pacg" features are tied in rustc, but detection isn't tied #1352

Description

@calebzulawski

In rustc, the "paca" and "pacg" features are tied together: https://github.com/rust-lang/rust/blob/a876a4df32b402e3886cd9f2af02cff3dd8e21c8/compiler/rustc_codegen_ssa/src/target_features.rs#L147-L149
Enabling one always enables the other, so I think detection should check both as well.

I don't know if there are any CPUs that have one and not the other, but this could potentially be unsound:

#[target_feature(enable = "paca")] // enables both "paca" and "pacg"
unsafe fn foo() {}

if is_aarch64_feature_detected!("paca") {
    // this would perhaps fail:
    // assert!(is_aarch64_feature_detected!("pacg"))
    unsafe { foo() }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions