1
Fork 0

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
This commit is contained in:
bjorn3 2024-07-31 15:33:58 +02:00
parent 68b99fcb91
commit f340c81caa

View file

@ -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![]
}