Skip to content

fix(ndk_compat): detect ANDROID_CPU_ARM_FEATURE_ARMv7 on ARMv8+ kerne… - #474

Merged
gchatelet merged 1 commit into
google:mainfrom
weihsu996:patch-1
Sep 30, 2026
Merged

gchatelet merged 1 commit into
google:mainfrom
weihsu996:patch-1

Conversation

@weihsu996

Copy link
Copy Markdown

…ls (info.architecture >= 7)

When a 32-bit armeabi-v7a Android process runs on a 64-bit ARMv8+ Linux kernel (common on Android TV / Google TV devices with 64-bit kernels and 32-bit userspace), /proc/cpuinfo reports CPU architecture: 8, so GetArmInfo() sets info.architecture = 8.

Previously, android_cpuInit() checked if (info.architecture == 7), leaving ANDROID_CPU_ARM_FEATURE_ARMv7 unset (0) on ARMv8+ kernels. Callers checking (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_ARMv7) before dispatching to NEON routines silently fell back to scalar code.

Use if (info.architecture >= 7) (matching if (info.architecture >= 6) on line 117) so 32-bit ARMv7+ processes on ARMv8+ kernels properly report ANDROID_CPU_ARM_FEATURE_ARMv7.

…ls (info.architecture >= 7)

When a 32-bit `armeabi-v7a` Android process runs on a 64-bit ARMv8+ Linux kernel (common on Android TV / Google TV devices with 64-bit kernels and 32-bit userspace), `/proc/cpuinfo` reports `CPU architecture: 8`, so `GetArmInfo()` sets `info.architecture = 8`.

Previously, `android_cpuInit()` checked `if (info.architecture == 7)`, leaving `ANDROID_CPU_ARM_FEATURE_ARMv7` unset (`0`) on ARMv8+ kernels. Callers checking `(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_ARMv7)` before dispatching to NEON routines silently fell back to scalar code.

Use `if (info.architecture >= 7)` (matching `if (info.architecture >= 6)` on line 117) so 32-bit ARMv7+ processes on ARMv8+ kernels properly report `ANDROID_CPU_ARM_FEATURE_ARMv7`.
@gchatelet
gchatelet merged commit 4539c9b into google:main Sep 30, 2026
38 of 40 checks passed
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.

2 participants