Skip to content

Commit 07b68f3

Browse files
committed
cpu: Expand dynamic detection to all supported OSs on AArch64.
1 parent cff897e commit 07b68f3

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ name = "ring"
167167
getrandom = { version = "0.2.8" }
168168
untrusted = { version = "0.9" }
169169

170-
[target.'cfg(any(target_arch = "x86",target_arch = "x86_64", all(any(target_arch = "aarch64", target_arch = "arm"), any(target_os = "android", target_os = "fuchsia", target_os = "linux", target_os = "windows"))))'.dependencies]
170+
[target.'cfg(any(target_arch = "x86",target_arch = "x86_64", all(target_arch = "aarch64", any(target_family = "unix", target_family = "windows")), all(target_arch = "arm", any(target_os = "android", target_os = "fuchsia", target_os = "linux", target_os = "windows"))))'.dependencies]
171171
spin = { version = "0.9.2", default-features = false, features = ["once"] }
172172

173173
[target.'cfg(all(target_arch = "arm", any(target_os = "android", target_os = "linux")))'.dependencies]

src/cpu.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,30 @@ pub(crate) struct Features(());
2424

2525
#[inline(always)]
2626
pub(crate) fn features() -> Features {
27-
// We don't do runtime feature detection on aarch64-apple-* as all AAarch64
28-
// features we use are available on every device since the first devices.
27+
// TODO: The list of operating systems for `aarch64` should really be
28+
// "whatever has `std::arch::is_aarch64_feature_detected`".
2929
#[cfg(any(
3030
target_arch = "x86",
3131
target_arch = "x86_64",
3232
all(
33-
any(target_arch = "aarch64", target_arch = "arm"),
33+
target_arch = "aarch64",
34+
any(
35+
target_os = "android",
36+
target_os = "dragonfly",
37+
target_os = "freebsd",
38+
target_os = "illumos",
39+
target_os = "ios",
40+
target_os = "linux",
41+
target_os = "macos",
42+
target_os = "netbsd",
43+
target_os = "openbsd",
44+
target_os = "redox",
45+
target_os = "solaris",
46+
target_os = "windows",
47+
)
48+
),
49+
all(
50+
target_arch = "arm",
3451
any(
3552
target_os = "android",
3653
target_os = "fuchsia",
@@ -52,15 +69,7 @@ pub(crate) fn features() -> Features {
5269
}
5370
}
5471

55-
#[cfg(all(
56-
any(target_arch = "aarch64", target_arch = "arm"),
57-
any(
58-
target_os = "android",
59-
target_os = "fuchsia",
60-
target_os = "linux",
61-
target_os = "windows"
62-
)
63-
))]
72+
#[cfg(any(target_arch = "aarch64", target_arch = "arm"))]
6473
{
6574
arm::setup();
6675
}

src/cpu/arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ macro_rules! features {
6767
};
6868
)+
6969

70-
#[cfg(target_arch = "aarch64")]
70+
#[cfg(all(target_arch = "aarch64", any(target_family = "unix", target_family = "windows")))]
7171
pub fn setup() {
7272
extern crate std;
7373
use std::arch::is_aarch64_feature_detected;

0 commit comments

Comments
 (0)