Skip to content

Commit

Permalink
getauxval isn't defined on uclibc, so disable dynamic feature detection
Browse files Browse the repository at this point in the history
  • Loading branch information
skrap authored and briansmith committed Nov 14, 2023
1 parent 7fa58cc commit 445de2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) fn features() -> Features {
any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux",
all(target_os = "linux", not(target_env = "uclibc")),
target_os = "windows"
)
))]
Expand Down
15 changes: 12 additions & 3 deletions src/cpu/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@
allow(dead_code)
)]

// uclibc: When linked statically, uclibc doesn't provide getauxval.
// When linked dynamically, recent versions do provide it, but we
// want to support older versions too. Assume that if uclibc is being
// used, this is an embedded target where the user cares a lot about
// minimizing code size and also that they know in advance exactly
// what target features are supported, so rely only on static feature
// detection.

#[cfg(all(
any(target_os = "android", target_os = "linux"),
any(target_arch = "aarch64", target_arch = "arm")
any(target_arch = "aarch64", target_arch = "arm"),
not(target_env = "uclibc")
))]
fn detect_features() -> u32 {
use libc::c_ulong;
Expand Down Expand Up @@ -196,7 +205,7 @@ impl Feature {
any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux",
all(target_os = "linux", not(target_env = "uclibc")),
target_os = "windows"
),
any(target_arch = "arm", target_arch = "aarch64")
Expand Down Expand Up @@ -251,7 +260,7 @@ features! {
any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux",
all(target_os = "linux", not(target_env = "uclibc")),
target_os = "windows"
)
))]
Expand Down

0 comments on commit 445de2f

Please sign in to comment.