Pass +atomics-32 feature for thumbv6m target

https://reviews.llvm.org/D120026 changed atomics on thumbv6m to
use libatomic, to ensure that atomic load/store are compatible with
atomic RMW/CAS. However, Rust wants to expose only load/store
without libcalls.

https://reviews.llvm.org/D130480 added support for this behind
the +atomics-32 target feature, so enable that feature.
This commit is contained in:
Nikita Popov 2022-07-27 14:26:00 +02:00
parent 9d97606193
commit 89582e8193
2 changed files with 5 additions and 1 deletions

View File

@ -440,6 +440,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
.features
.split(',')
.filter(|v| !v.is_empty() && backend_feature_name(v).is_some())
// Drop +atomics-32 feature introduced in LLVM 15.
.filter(|v| *v != "+atomics-32" || get_version() >= (15, 0, 0))
.map(String::from),
);

View File

@ -13,7 +13,9 @@ pub fn target() -> Target {
abi: "eabi".into(),
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
// with +strict-align.
features: "+strict-align".into(),
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
features: "+strict-align,+atomics-32".into(),
// There are no atomic CAS instructions available in the instruction set of the ARMv6-M
// architecture
atomic_cas: false,