Description
This is an instance of #116344, but since it affects a target feature marked as "stable" I made a separate issue. See rust-lang/compiler-team#780 for the MCP that approved forbidding the toggling of target features that are unsound due to their ABI impact. Stabilization of neon
happened in #90621. I am not sure where the FCP for this occurred.
The summary of the problem is that code compiled with -C target-feature=-neon
on an aarch64 target, if it calls any pre-compiled function from the standard library that involves f32
/f64
arguments, will use the wrong ABI and hence cause UB. I am working towards marking such features as "forbidden" so that we can fix this soundness hole. But now we are hitting the same where a relevant feature is also already stable, so making it "forbidden" would be a breaking change... so we'll have to figure out something more clever. Like maybe only forbidding disabling the feature? Note however that on the aarch64-unknown-none-softfloat
target, +neon
is unsound for the same reason.
Activity
-Ctarget-feature
#116344jacobbramley commentedon Sep 30, 2024
aarch64-unknown-none-softfloat
+neon
could potentially use some soft-float procedure-call standard but use Neon/FP inside functions. That's what the AArch32softfp
ABIs used to do, and the use-case is possibly similar. It'd be a change of behaviour for code compiled with different Rust versions, perhaps.RalfJung commentedon Sep 30, 2024
I don't think LLVM currently supports this. On other architectures, it is possible to force a soft-float ABI while still having FP instructions and registers available inside functions (e.g.
+soft-float,+sse2
on x86), but aarch64 does not seem to have that option right now.apiraino commentedon Sep 30, 2024
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-high
workingjubilee commentedon Sep 30, 2024
imo the major reason that we support
neon
as a feature flag is so that people can writecfg(target_feature = "neon")
ortarget_feature(enable = "neon")
for aarch64 embedded targets (since while the FPU should always be present, you do have to enable it first, and that might not be automatic for some embedded programs...), not so they can unsoundly globally disable it on targets that assume its presence.46 remaining items