about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-01-29 06:03:24 +0100
committerGitHub <noreply@github.com>2025-01-29 06:03:24 +0100
commit0b1d71775877c14e7a7ffb9c8023d85ae7d54a57 (patch)
treee9179a1e897da4fe09db681fccaf023c1cd22fb3 /compiler
parente37b744baedf8b13e021f94d3b8e4f7983b9cbd5 (diff)
parent7f83f8ae727adb4893a83abea9d5dc0ea5a9b149 (diff)
Rollup merge of #136170 - taiki-e:atomics-32, r=workingjubilee
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  (https://github.com/llvm/llvm-project/commit/f5ed0cb217a9988f97b55f2ccb053bca7b41cc0c) 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
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_target/src/target_features.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index 9fd07c8634a..46e29304502 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -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"]),