Add CPU feature detection using elf_aux_info#130901
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
|
BA is green, other failures are unrelated to conditional freebsd change. |
|
Workflow state for the Holistic Review Orchestrator. {
"version": 5,
"last_dispatched_commit": "f833df72b91e46156bf20609faea2e180b3d9917",
"last_dispatched_base_ref": "main",
"last_dispatched_base_sha": "a0ad638fb14e9f3ad2c11588f6fb3a1610c8be08",
"last_reviewed_commit": "f833df72b91e46156bf20609faea2e180b3d9917",
"last_reviewed_base_ref": "main",
"last_reviewed_base_sha": "a0ad638fb14e9f3ad2c11588f6fb3a1610c8be08",
"last_recorded_worker_run_id": "29687172567",
"review_attempt_commit": "",
"review_attempt_base_ref": "",
"review_attempt_count": 0,
"max_review_attempts": 5,
"review_history_format": "holistic-review-disclosure-v1",
"review_history": [
{
"commit": "f833df72b91e46156bf20609faea2e180b3d9917",
"review_id": 4730767519
}
]
} |
There was a problem hiding this comment.
Holistic Review
Motivation: On freebsd-arm64, NativeAOT smoke tests were aborting with "The current CPU is missing one or more of the following instruction sets: AdvSimd" — a net11.0 regression from #118101. FreeBSD lacks the glibc getauxval/asm/hwcap.h mechanism, so HAVE_AUXV_HWCAP_H is false there and the ARM64 baseline (AdvSimd) was never detected, wrongly marking the CPU as unsupported. The motivation is clear and well documented with reproducing CI links.
Approach: Adds a check_symbol_exists(elf_aux_info "sys/auxv.h" HAVE_ELF_AUX_INFO) probe and a corresponding minipalconfig.h.in entry, then introduces a third ARM64 hardware-capability branch. The getauxval/elf_aux_info/sysctlbyname selection is restructured into a single #if HAVE_AUXV_HWCAP_H ... #elif HAVE_ELF_AUX_INFO ... #elif HAVE_SYSCTLBYNAME chain. On the FreeBSD branch, hwCap/hwCap2 are zero-initialized and populated via elf_aux_info(AT_HWCAP, ...) / elf_aux_info(AT_HWCAP2, ...), then feed the existing shared HWCAP_*/HWCAP2_* bit-test logic. hwCap2 is hoisted up so both the glibc and FreeBSD paths declare it once. The include of <sys/auxv.h> is now guarded by HAVE_ELF_AUX_INFO at the top of the file, and minipalconfig.h is included unconditionally (moved out of the #else HOST_WINDOWS block). This is a minimal, well-targeted change that preserves existing Linux and macOS behavior.
Summary: A small, focused, low-risk portability fix that correctly restores ARM64 baseline ISA detection on FreeBSD. The control-flow restructuring keeps the Linux and macOS paths semantically identical. Zero-initializing the hwcaps before elf_aux_info is the right defensive choice since a failed lookup leaves the buffer untouched (it would then just report no optional features rather than crashing). I have one non-blocking portability observation, filed inline, about the scope of the fallback HWCAP_* macro definitions on the new FreeBSD branch. Overall this looks good to merge; verify the FreeBSD CI/cross-repo AOT run is green.
Detailed Findings
See the inline comment on src/native/minipal/cpufeatures.c regarding the fallback HWCAP_*/HWCAP2_* #ifndef definitions being scoped only to the HAVE_AUXV_HWCAP_H include block, which leaves the new elf_aux_info branch dependent on FreeBSD's own headers providing every constant. Non-blocking, but worth considering for robustness across FreeBSD versions.
Note
This review was generated by this repository's Holistic Review agentic workflow to complement the built-in Copilot review.
Generated by Holistic Review · 68.3 AIC · ⌖ 11.2 AIC · ⊞ 10K
When running AOT smoke tests on freebsd-arm64, it was failing AOT apps with:
[6](https://github.com/am11/CrossRepoCITesting/actions/runs/29426499240/job/87390152366#step:5:336) Running /home/runner/work/CrossRepoCITesting/CrossRepoCITesting/runtime/artifacts/tests/coreclr/freebsd.arm64.Checked/nativeaot/SmokeTests/PInvoke/PInvoke/native/PInvoke... The current CPU is missing one or more of the following instruction sets: AdvSimd Abort trapIt's a net11.0 regression from #118101; now passing: https://github.com/am11/CrossRepoCITesting/actions/runs/29519372748/job/87692356810