Open workingjubilee opened 1 week ago
In summary:
ilp32e
/lp64e
rely on the e
feature being disabled.ilp32f
/lp64f
ABI rely on the f
feature being enabled.ilp32d
/lp64d
ABI rely on the d
feature being enabled.q
feature yet, but a similar rule will apply with that feature and the lp64q
ABI).forced-atomics
feature must never be disabled if it is enabled, as the forced-atomics
feature changes the ABI of atomic operations (as mentioned in this section of the LLVM atomics documentation).Notes:
f
/d
features on targets using softer ABIs is fine, as is disabling the e
feature, as all RISC-V targets explicitly state their ABI due to https://github.com/rust-lang/rust/pull/131807.a
feature causes atomic operations to be compiled using __atomic_*
libcalls instead of native operations, but AFAICT the worst possible outcome here is a linker error if libatomic is not linked - according to the LLVM atomics documentation, __atomic_*
libcalls must use a lock-free implementation for all atomic sizes that the compiler can emit native instructions for (which are the only sizes of atomics Rust supports).cc @coastalwhite (as author of https://github.com/rust-lang/rust/pull/116485 which got scaled back due to precisely this question!)
Just realised I missed the e
feature from my summary; I've edited my comment above to include it.
Also I haven't included above the cases where LLVM will emit an error itself due to feature incompatibility. Checking the features mentioned https://github.com/rust-lang/rust/pull/116485, those are:
f
and zfinx
features are incompatible.d
feature is incompatible with the ilp32e
ABI.In both these cases LLVM will already emit a fatal error, but it would definitely be better diagnostic UX for rustc
to detect the problem and emit an error itself.
Thanks for the summary! That seems pretty definite in terms of a "yes, we should", yeah.
refs:
in discussion of the target modifiers RFC^1, Ralf asks this question:
cc @beetrees