Skip to content

arch/arm64: make per-core -mcpu flags reachable in both build systems - #20402

Open
rikaken2004 wants to merge 1 commit into
apache:masterfrom
rikaken2004:arm64-toolchain-mcpu
Open

rikaken2004 wants to merge 1 commit into
apache:masterfrom
rikaken2004:arm64-toolchain-mcpu

Conversation

@rikaken2004

Copy link
Copy Markdown
Contributor

Summary

Every ARCH_CORTEX_A5x config selects ARCH_ARMV8A (arch/arm64/Kconfig), and both arch/arm64/src/Toolchain.defs and arch/arm64/src/cmake/Toolchain.cmake test CONFIG_ARCH_ARMV8A at the head of the chain — so the -mcpu=cortex-a53/a55/a57/a72 branches were unreachable, and every Cortex-A target built with plain -march=armv8-a, losing per-core scheduling/tuning. Reported as #20400.

This PR tests the specific cores first so -mcpu actually wins, while the generic ARCH_ARMV8A branch (with its armv8.5-a/MTE handling) still covers cores without a dedicated entry. The ARCH_ARMV8R/cortex-r82 ordering is left untouched on purpose: -mcpu=cortex-r82 would imply an FPU for nofp configurations, whereas the Cortex-A -mcpu values are safe supersets of -march=armv8-a here. Also adds the missing cortex-a55 branch to the cmake toolchain for parity with the makefile.

Impact

Cortex-A53/A55/A57/A72 targets now compile with per-core tuning (-mcpu=...) in both make and cmake builds. No change for other arch variants or for targets already covered by the generic branch.

Testing

Verified the condition ordering against the select chains in arch/arm64/Kconfig; flag change only, no runtime behaviour change beyond compiler scheduling/tuning.

Every ARCH_CORTEX_A5x config selects ARCH_ARMV8A, and both
Toolchain.defs and cmake/Toolchain.cmake test CONFIG_ARCH_ARMV8A at
the head of the chain, so the -mcpu=cortex-a53/a55/a57/a72 branches
were unreachable and all Cortex-A targets built with plain
-march=armv8-a, losing per-core scheduling/tuning.

Test the specific cores first so -mcpu wins for them; the generic
ARCH_ARMV8A branch still covers cores without a dedicated entry and
keeps the armv8.5-a/MTE handling. Also add the missing cortex-a55
branch to the cmake toolchain for parity with the makefile.

Signed-off-by: rikaken2004 <244897142+rikaken2004@users.noreply.github.com>
@github-actions github-actions Bot added Arch: arm64 Issues related to ARM64 (64-bit) architecture Size: S The size of the change in this PR is small labels Sep 30, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm64 Issues related to ARM64 (64-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arm64 toolchain: -mcpu=cortex-* branches are unreachable in both Toolchain.defs and cmake/Toolchain.cmake

2 participants