Skip to content

Commit

Permalink
Rollup merge of #136170 - taiki-e:atomics-32, r=workingjubilee
Browse files Browse the repository at this point in the history
Reject unsound toggling of Arm atomics-32 target feature

This target feature has the same semantics as RISC-V `forced-atomics` target feature that already marked as Forbidden  (llvm/llvm-project@f5ed0cb) and toggling it can cause ABI incompatibility.

https://github.com/rust-lang/rust/blob/2f348cb7ce4063fa4eb40038e6ada3c5214717bd/compiler/rustc_target/src/target_features.rs#L479-L483

[Comment on feature definition in LLVM](https://github.com/llvm/llvm-project/blob/7109f521975e9cc2e8ba4f52ac2a8e1140bd49b5/llvm/lib/Target/ARM/ARMFeatures.td#L572-L574) also says:

> Code built with this feature is not ABI-compatible with code built without this feature, if atomic variables are exposed across the ABI boundary.

r? `@workingjubilee` or `@RalfJung`

`@rustbot` label +O-Arm
  • Loading branch information
fmease authored Jan 29, 2025
2 parents e37b744 + 7f83f8a commit 0b1d717
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ const ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
// tidy-alphabetical-start
("aclass", Unstable(sym::arm_target_feature), &[]),
("aes", Unstable(sym::arm_target_feature), &["neon"]),
(
"atomics-32",
Stability::Forbidden { reason: "unsound because it changes the ABI of atomic operations" },
&[],
),
("crc", Unstable(sym::arm_target_feature), &[]),
("d32", Unstable(sym::arm_target_feature), &[]),
("dotprod", Unstable(sym::arm_target_feature), &["neon"]),
Expand Down

0 comments on commit 0b1d717

Please sign in to comment.