mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 01:25:15 +00:00
LLVM does not support host feature detection (only host cpu detection) on apple platforms. As such, the returned feature string will be empty. Adding this empty string to the target-features attribute results in a verifier error on LLVM 22. Fix this by not adding the empty string to the target features. The reason why this was not caught by the target-cpu-native test is that it requires a function that adds *some* target features, otherwise the attribute is omitted entirely. We achieve this with a somewhat peculiar construction that enables `neon` if it's already enabled. (This is to avoid enabling it on softfloat targets.)
10 lines
305 B
Rust
10 lines
305 B
Rust
fn main() {}
|
|
|
|
// This forces explicit emission of a +neon target feature on targets
|
|
// where it is implied by the target-cpu, like aarch64-apple-darwin.
|
|
// This is a regression test for #153397.
|
|
#[cfg(target_feature = "neon")]
|
|
#[target_feature(enable = "neon")]
|
|
#[unsafe(no_mangle)]
|
|
pub fn with_neon() {}
|