Skip to content

Detect hard-float support on aarch64 kernels running armv7 userspace#18530

Merged
zanieb merged 1 commit intomainfrom
zb/hf-aarch64
Mar 18, 2026
Merged

Detect hard-float support on aarch64 kernels running armv7 userspace#18530
zanieb merged 1 commit intomainfrom
zb/hf-aarch64

Conversation

@zanieb
Copy link
Copy Markdown
Member

@zanieb zanieb commented Mar 17, 2026

Pulled out of #18517

I don't have aarch64 hardware available locally, but Claude posited:

When an armv7 binary runs on an aarch64 kernel (e.g., armv7l containers on aarch64 hosts, or 32-bit Raspberry Pi OS on 64-bit hardware), /proc/cpuinfo reports aarch64-style feature flags instead of armv7 flags. The existing check for "vfp" fails because aarch64 uses "fp" instead.

Add detection of the aarch64 "fp" feature flag (mandatory on all aarch64 CPUs) as a discrete token, indicating hardware floating-point support. This ensures uv selects the gnueabihf (hard-float) Python variant instead of the gnueabi (soft-float) variant.

I reproduced this in #18532

Under QEMU on aarch64 macOS, both the vfp and fp feature flags are set.

Closes #18509

When an armv7 binary runs on an aarch64 kernel (e.g., armv7l containers on
aarch64 hosts, or 32-bit Raspberry Pi OS on 64-bit hardware), /proc/cpuinfo
reports AArch64-style feature flags instead of ARM-32 flags. The existing
check for "vfp" fails because AArch64 uses "fp" instead.

Add detection of the AArch64 "fp" feature flag (mandatory on all AArch64
CPUs) as a discrete token, indicating hardware floating-point support. This
ensures uv selects the gnueabihf (hard-float) Python variant instead of
the gnueabi (soft-float) variant.

Closes #18509
@zanieb zanieb marked this pull request as ready for review March 17, 2026 23:04
@zanieb zanieb requested a review from geofft March 17, 2026 23:04
Comment on lines +52 to +55
#[cfg(test)]
mod tests {
#[cfg(target_os = "linux")]
use super::has_hardware_float_features;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could certainly be convinced to just drop these tests

@zanieb zanieb merged commit 8998568 into main Mar 18, 2026
54 checks passed
@zanieb zanieb deleted the zb/hf-aarch64 branch March 18, 2026 12:52
zanieb added a commit that referenced this pull request Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How does uv determine the host CPU capabilities on armv7l?

1 participant