Skip to content

Commit b934645

Browse files
committed
arm: Call getauxval through libc.
See rust-lang/stdarch#1746. libc 0.2.172 added getauxval for 32-bit ARM Android.
1 parent 6401089 commit b934645

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ getrandom = { version = "0.2.10" }
163163
untrusted = { version = "0.9" }
164164

165165
[target.'cfg(all(any(all(target_arch = "aarch64", target_endian = "little"), all(target_arch = "arm", target_endian = "little")), any(target_os = "android", target_os = "linux")))'.dependencies]
166-
libc = { version = "0.2.148", default-features = false }
166+
libc = { version = "0.2.172", default-features = false }
167167

168168
[target.'cfg(all(all(target_arch = "aarch64", target_endian = "little"), target_vendor = "apple", any(target_os = "ios", target_os = "macos", target_os = "tvos", target_os = "visionos", target_os = "watchos")))'.dependencies]
169-
libc = { version = "0.2.155", default-features = false }
169+
libc = { version = "0.2.172", default-features = false }
170170

171171
[target.'cfg(all(all(target_arch = "aarch64", target_endian = "little"), target_os = "windows"))'.dependencies]
172172
windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_System_Threading"] }
@@ -175,7 +175,7 @@ windows-sys = { version = "0.52", features = ["Win32_Foundation", "Win32_System_
175175
wasm-bindgen-test = { version = "0.3.37", default-features = false, features = ["std"] }
176176

177177
[target.'cfg(any(unix, windows, target_os = "wasi"))'.dev-dependencies]
178-
libc = { version = "0.2.148", default-features = false }
178+
libc = { version = "0.2.172", default-features = false }
179179

180180
[build-dependencies]
181181
cc = { version = "1.2.8", default-features = false }

src/cpu/arm/linux.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,8 @@ pub fn detect_features() -> u32 {
4747
#[cfg(not(target_env = "uclibc"))]
4848
{
4949
use super::CAPS_STATIC;
50+
use libc::{c_ulong, getauxval, AT_HWCAP};
5051

51-
// The `libc` crate doesn't provide this functionality on all
52-
// 32-bit Linux targets, like Android or -musl. Use this polyfill
53-
// for all 32-bit ARM targets so that testing on one of them will
54-
// be more meaningful to the others.
55-
use libc::c_ulong;
56-
extern "C" {
57-
pub fn getauxval(type_: c_ulong) -> c_ulong;
58-
}
59-
const AT_HWCAP: c_ulong = 16;
6052
const HWCAP_NEON: c_ulong = 1 << 12;
6153

6254
if CAPS_STATIC & Neon::mask() != Neon::mask() {

0 commit comments

Comments
 (0)