about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-07-31 15:33:58 +0200
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-07-31 15:33:58 +0200
commitf340c81caac9bca69fba16a9e6f7622fa099d20a (patch)
tree38ffb307c371f488c794d34b3879252603b8fae1
parent68b99fcb9148c48d30a385ba72e34cc0aa6e94a9 (diff)
downloadrust-f340c81caac9bca69fba16a9e6f7622fa099d20a.tar.gz
rust-f340c81caac9bca69fba16a9e6f7622fa099d20a.zip
Statically enable a couple of target features always enabled on arm64 macOS
Ring fails to compile when they are not statically enabled when
compiling for macOS.

Fixes rust-lang/rustc_codegen_cranelift#1522
-rw-r--r--src/lib.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8d3d5ac98e1..fab36104845 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -191,9 +191,20 @@ impl CodegenBackend for CraneliftCodegenBackend {
         if sess.target.arch == "x86_64" && sess.target.os != "none" {
             // x86_64 mandates SSE2 support
             vec![Symbol::intern("fxsr"), sym::sse, Symbol::intern("sse2")]
-        } else if sess.target.arch == "aarch64" && sess.target.os != "none" {
-            // AArch64 mandates Neon support
-            vec![sym::neon]
+        } else if sess.target.arch == "aarch64" {
+            match &*sess.target.os {
+                "none" => vec![],
+                // On macOS the aes, sha2 and sha3 features are enabled by default and ring
+                // fails to compile on macOS when they are not present.
+                "macos" => vec![
+                    sym::neon,
+                    Symbol::intern("aes"),
+                    Symbol::intern("sha2"),
+                    Symbol::intern("sha3"),
+                ],
+                // AArch64 mandates Neon support
+                _ => vec![sym::neon],
+            }
         } else {
             vec![]
         }