about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-02 22:44:26 +0100
committerGitHub <noreply@github.com>2025-03-02 22:44:26 +0100
commit8152da82b51a16fbb7a072462af01d15b0b2c8d3 (patch)
tree1c26ee92e2e205e03c685a2101fcf14264570082
parentc994a293925935164c63dfeb5dd1d7ad2b66b34c (diff)
parentc51b229140c885cac757a405a328a07e90d5bca9 (diff)
downloadrust-8152da82b51a16fbb7a072462af01d15b0b2c8d3.tar.gz
rust-8152da82b51a16fbb7a072462af01d15b0b2c8d3.zip
Rollup merge of #137873 - tgross35:disable-f16-without-neon, r=workingjubilee
Disable `f16` on Aarch64 without `neon`

LLVM has crashes at some `half` operations when built with assertions enabled if fp-armv8 is not available [1]. Things seem to usually work, but we are reaching LLVM undefined behavior so this needs to be disabled.

[1]: https://github.com/llvm/llvm-project/issues/129394
-rw-r--r--library/std/build.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/build.rs b/library/std/build.rs
index 723d1eb02e0..9df35ce3cc8 100644
--- a/library/std/build.rs
+++ b/library/std/build.rs
@@ -12,6 +12,11 @@ fn main() {
         .expect("CARGO_CFG_TARGET_POINTER_WIDTH was not set")
         .parse()
         .unwrap();
+    let target_features: Vec<_> = env::var("CARGO_CFG_TARGET_FEATURE")
+        .unwrap_or_default()
+        .split(",")
+        .map(ToOwned::to_owned)
+        .collect();
     let is_miri = env::var_os("CARGO_CFG_MIRI").is_some();
 
     println!("cargo:rustc-check-cfg=cfg(netbsd10)");
@@ -101,6 +106,8 @@ fn main() {
         ("s390x", _) => false,
         // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
         ("arm64ec", _) => false,
+        // LLVM crash <https://github.com/llvm/llvm-project/issues/129394>
+        ("aarch64", _) if !target_features.iter().any(|f| f == "neon") => false,
         // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
         ("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false,
         // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>