-
Notifications
You must be signed in to change notification settings - Fork 13.8k
std_detect on Darwin AArch64: update features #146397
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
rustbot has assigned @Mark-Simulacrum. Use |
Now that this feature has a standard identifier, Darwin has started exposing it accordingly, in addition to the existing less-standard way. Check both, and enable the `crc` feature if either identifier for it is present to ensure backwards and forwards compatibility.
bca0a0a
to
37a47d6
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Brings the list of checkable features up to date with the initial release of macOS 26 "Tahoe".
37a47d6
to
d49f6a7
Compare
let mte_no_address_tags = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_NO_ADDRESS_TAGS"); | ||
let mte_store_only = _sysctlbyname(c"hw.optional.arm.FEAT_MTE_STORE_ONLY"); | ||
let mte3 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE3"); | ||
let mte4 = _sysctlbyname(c"hw.optional.arm.FEAT_MTE4"); |
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.
Why not add to this block for the new detected features? Do the changes in this PR expose new stable surface area (I'm not super familiar with how std_detect is wired up...
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.
This commented out part of the list contains features that std_detect doesn’t currently keep track of; if and when any of them become trackable they should get moved to the non-commented list above. See detect/arch/aarch64.rs
for the list of features that are currently tracked; it’s related to LLVM’s support for them.
As for “stable surface area”, this changes it to the extent that existing code recompiled with a new Rust release may start detecting features on AArch64 Darwin that it didn’t before, if running on a sufficiently new Apple Silicon chip. That’s the only possible change; no new symbols are exposed, nor is any program able to ask/talk about anything new it couldn’t before. It just might get different answers to those existing questions than it used to, under the above circumstances.
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.
Can you write up a description of what answers are different with this PR?
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.
Can you write up a description of what answers are different with this PR?
Absolutely!
The specific questions whose answers might change are all of the form is_aarch64_feature_detected!(…)
executed on an Apple OS on an Arm CPU, where …
is one of the following:
"crc"
: this currently returnstrue
for all Apple Silicon chips; prior to this PR, there is a possibility that under future Apple OSes that answer could incorrectly becomefalse
. This PR ensures that it remainstrue
for the foreseeable future, accurately reflecting the presence of this mandatory CPU feature."mte"
: this currently always returnsfalse
on these platforms, reflecting that no current Apple Silicon CPU supports the Memory Tagging Extension. Apple have at this point publicly announced that their incoming A19 and A19 Pro CPUs support this feature, and it’s a safe bet given the history of Apple Silicon that future chips (M5 family and onward) will also have it. Darwin now exposes a way to check for this, so after this PR Rust code running on Darwin on such a near-future CPU will accurately reporttrue
to this question."sme2p1"
: Similarly to"mte"
’s case above, this is a feature that Darwin newly exposes a way to check for; it is version 2.1 of the Scalable Matrix Extension (SME). SME 2.0 is already exposed correctly on Apple M4/A18 family chips, and while no official word has come that A19/M5 will have SME 2.1, unofficial sources heavily suggest it, and taking advantage of the newly exposed ability to check for it is a good idea anyway.
No other uses of is_aarch64_feature_detected!
are changed by this PR, and it remains entirely unaffected on all non-Darwin platforms. The only other change to the non-commented code in this PR is to alphabetize the list properly since it was a bit out of order before; that doesn’t change the functionality of the code at all. Commented code is altered to reflect that Darwin now exposes a variety of subversions and subfeatures of MTE, of which only MTE(1) and MTE2 are something is_aarch64_feature_detected!
can ask about (and then only as a pair).
r? @Amanieu -- not sure if we have a policy for needing libs-api FCP for exposing new detections in this code or not, but seems plausible that we would want that. Would also be useful to get your opinion on the code changes, I think you're most familiar with this area. |
This doesn't need an FCP since it's not modifying a public API, it's just making the existing API work better under a particular platform. The code changes also look fine to me. @bors r+ |
std_detect on Darwin AArch64: update features Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
Rollup of 8 pull requests Successful merges: - #146317 (Add panic=immediate-abort) - #146397 (std_detect on Darwin AArch64: update features) - #146594 (bootstrap: Don't force -static for musl targets in cc-rs) - #146791 (emit attribute for readonly non-pure inline assembly) - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - #146838 (Introduce "wrapper" helpers to rustdoc) - #146846 (btree InternalNode::new safety comments) - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) r? `@ghost` `@rustbot` modify labels: rollup
std_detect on Darwin AArch64: update features Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
Rollup of 10 pull requests Successful merges: - #145411 (regression test for Cow<[u8]> layout) - #146317 (Add panic=immediate-abort) - #146397 (std_detect on Darwin AArch64: update features) - #146594 (bootstrap: Don't force -static for musl targets in cc-rs) - #146652 (Port `feature` to the new attribute system) - #146791 (emit attribute for readonly non-pure inline assembly) - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - #146838 (Introduce "wrapper" helpers to rustdoc) - #146846 (btree InternalNode::new safety comments) - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) r? `@ghost` `@rustbot` modify labels: rollup
std_detect on Darwin AArch64: update features Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
Rollup of 9 pull requests Successful merges: - #145411 (regression test for Cow<[u8]> layout) - #146317 (Add panic=immediate-abort) - #146397 (std_detect on Darwin AArch64: update features) - #146594 (bootstrap: Don't force -static for musl targets in cc-rs) - #146791 (emit attribute for readonly non-pure inline assembly) - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - #146838 (Introduce "wrapper" helpers to rustdoc) - #146846 (btree InternalNode::new safety comments) - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #145411 (regression test for Cow<[u8]> layout) - #146317 (Add panic=immediate-abort) - #146397 (std_detect on Darwin AArch64: update features) - #146594 (bootstrap: Don't force -static for musl targets in cc-rs) - #146791 (emit attribute for readonly non-pure inline assembly) - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - #146838 (Introduce "wrapper" helpers to rustdoc) - #146846 (btree InternalNode::new safety comments) - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #145411 (regression test for Cow<[u8]> layout) - #146397 (std_detect on Darwin AArch64: update features) - #146791 (emit attribute for readonly non-pure inline assembly) - #146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - #146838 (Introduce "wrapper" helpers to rustdoc) - #146845 (Add self-profile events for target-machine creation) - #146846 (btree InternalNode::new safety comments) - #146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) - #146878 (assert_unsafe_precondition: fix some incorrect check_language_ub) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #146397 - pthariensflame:patch-1, r=Amanieu std_detect on Darwin AArch64: update features Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
std_detect on Darwin AArch64: update features Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
Rollup of 9 pull requests Successful merges: - rust-lang#145411 (regression test for Cow<[u8]> layout) - rust-lang#146397 (std_detect on Darwin AArch64: update features) - rust-lang#146791 (emit attribute for readonly non-pure inline assembly) - rust-lang#146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly) - rust-lang#146838 (Introduce "wrapper" helpers to rustdoc) - rust-lang#146845 (Add self-profile events for target-machine creation) - rust-lang#146846 (btree InternalNode::new safety comments) - rust-lang#146858 (Make mips64el-unknown-linux-muslabi64 link dynamically) - rust-lang#146878 (assert_unsafe_precondition: fix some incorrect check_language_ub) r? `@ghost` `@rustbot` modify labels: rollup
Synchronizes the list (and re-sorts it alphabetically by
FEAT
name) with the initial release version of macOS Tahoe.