Skip to content

Commit f340c81

Browse files
committed
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 #1522
1 parent 68b99fc commit f340c81

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/lib.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,20 @@ impl CodegenBackend for CraneliftCodegenBackend {
191191
if sess.target.arch == "x86_64" && sess.target.os != "none" {
192192
// x86_64 mandates SSE2 support
193193
vec![Symbol::intern("fxsr"), sym::sse, Symbol::intern("sse2")]
194-
} else if sess.target.arch == "aarch64" && sess.target.os != "none" {
195-
// AArch64 mandates Neon support
196-
vec![sym::neon]
194+
} else if sess.target.arch == "aarch64" {
195+
match &*sess.target.os {
196+
"none" => vec![],
197+
// On macOS the aes, sha2 and sha3 features are enabled by default and ring
198+
// fails to compile on macOS when they are not present.
199+
"macos" => vec![
200+
sym::neon,
201+
Symbol::intern("aes"),
202+
Symbol::intern("sha2"),
203+
Symbol::intern("sha3"),
204+
],
205+
// AArch64 mandates Neon support
206+
_ => vec![sym::neon],
207+
}
197208
} else {
198209
vec![]
199210
}

0 commit comments

Comments
 (0)