Repository navigation
Conversation
The aarch64 Linux path in cpuid.c included the kernel header
<asm/hwcap.h> for the HWCAP_* bits. On musl distributions such as Alpine
that header only exists with the linux-headers package installed, so
--enable-armasm and --enable-all-asm failed on aarch64 while x86 builds
needed nothing extra.
Take the bits from <sys/auxv.h> and define any the C library lacks, the
same way the 32-bit ARM path already does. musl does not define
HWCAP2_SME, so without the fallback SME would never be detected there.
With every bit now defined, the HWCAP_ASIMDRDM, HWCAP_SVE and HWCAP2_SME
guards around their checks are dropped.
The Fil-C workflow gave the missing header as the reason its aarch64
legs build with --disable-asm. With this change the aarch64 asm build
compiles under Fil-C, but sp_div_word's inline assembly panics at run
time: v0.684 has no aarch64 inline assembly, and v0.687 rejects the
shifted register operands in sp_div_word ("x5, lsr 1" and twice
"%[hi], lsl 32"). The comment now names sp_div_word instead.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the aarch64 CPU feature-detection update.
No open issues 🎉
What changed in this PR
Removes the Linux kernel header dependency from aarch64 CPU feature detection, allowing assembly-enabled wolfSSL builds on musl systems without linux-headers.
Changes:
- Uses
<sys/auxv.h>with fallback capability definitions instead of<asm/hwcap.h>. - Removes redundant capability guards, enabling SME detection where libc lacks its definition.
- Updates the Fil-C workflow comment to explain the remaining inline-assembly limitation; build configurations are unchanged.
| File | Description |
|---|---|
wolfcrypt/src/cpuid.c |
Adds fallback capability constants and simplifies aarch64 feature detection. |
.github/workflows/fil-c.yml |
Corrects the comment explaining why aarch64 assembly remains disabled. |
Review effort: Balanced
|
Member
Author
|
Jenkins retest this please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The aarch64 Linux CPU feature detection in
cpuid.cincluded the kernel header<asm/hwcap.h>. On musl distributions such as Alpine that header only exists withlinux-headersinstalled, so--enable-armasmand--enable-all-asmfailed to build on aarch64 withfatal error: asm/hwcap.h: No such file or directory.HWCAP_*bits from<sys/auxv.h>and define any the C library lacks, matching the 32-bit ARM path in the same file.HWCAP2_SME, so SME is now detected there.HWCAP_ASIMDRDM,HWCAP_SVEandHWCAP2_SMEguards incpuid_set_flagsare dropped.fil-c.yml: the comment explaining why the aarch64 Fil-C legs build with--disable-asmblamed the missing header. With this change that build compiles, but Fil-C panics on the inline assembly ofsp_div_wordinsp_int.c, so the comment now says that. No legs change.