Skip to content

ci: cross-compile the Cortex-M corners with clang as well as GCC - #176

Merged
danmcleran merged 1 commit into
masterfrom
ci/clang-arm-crosscompile
Aug 31, 2026
Merged

danmcleran merged 1 commit into
masterfrom
ci/clang-arm-crosscompile

Conversation

@danmcleran

Copy link
Copy Markdown
Owner

Closes the second of the two gaps flagged after #175 — the Arm cross-compile edge.

Why

arm_crosscompile proves the headers assemble for a Cortex-M with arm-none-eabi-g++. Clang is now a first-class host toolchain here, and the LLVM embedded toolchain for Arm is a real deployment path, so the target profile deserves the same second-compiler treatment the host already has.

Every finding from adding clang has been at an edge rather than in the core — a public header's pragma, no-op policy stubs, two example programs, a nested directory. The cross-compile edge was the last one uncovered.

How

No new toolchain to install. Clang cross-compiles by construction. It does need target C++ headers, and borrows the arm-none-eabi GCC ones that arm_crosscompile already requires. The include list is queried from that compiler rather than hardcoded, so the 13.2.1 in those paths cannot rot across toolchain versions.

-fno-exceptions -fno-rtti matches how this code is deployed and avoids depending on unwind tables bare-metal clang does not supply. Compile-only, like the GCC target.

All seven corners assemble clean:

Corner Result
M0+ soft-float, freestanding OK
M0+ soft-float, quant (deployable int8) OK
M4 hard-float, FLOAT=1 OK
M4 hard-float, quant OK
M4 hard-float, fp16 + quant OK
M33 hard-float, freestanding OK
M33 hard-float, quant OK

Verified it isn't silently building for the host

That is exactly how a cross-compile gate fails quietly, so I checked rather than assumed:

  • The emitted object is ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV)
  • A TU asserting sizeof(void*)==8 compiles under host clang and fails under the target flags

New hard gate Clang cross-compile (Cortex-M). Branch protection update (16 → 17) is the separate step after merge.

The other gap

MSan coverage for the Boost suites is not in this PR. It needs an MSan-instrumented libc++ (cmake/ninja are not available in this environment to build one), so it cannot be verified here the way everything else in this series has been. Handling it separately rather than shipping an unverified job.

🤖 Generated with Claude Code

https://claude.ai/code/session_019tVgXeXCcfbHqfMjhufWzd

arm_crosscompile proves the headers assemble for a Cortex-M with
arm-none-eabi-g++. Clang is now a first-class host toolchain here and the LLVM
embedded toolchain for Arm is a real deployment path, so the target profile
deserves the same second-compiler treatment the host already has. Every finding
from adding clang so far has been at an edge rather than in the core, and the
cross-compile edge was the last one left uncovered.

No new toolchain to install: clang cross-compiles by construction. It does need
target C++ headers, and borrows the arm-none-eabi GCC ones that
arm_crosscompile already requires. The include list is queried from that
compiler rather than hardcoded, so the 13.2.1 in those paths cannot rot across
toolchain versions. -fno-exceptions -fno-rtti matches how this code is deployed
and avoids depending on unwind tables bare-metal clang does not supply.
Compile-only, like the GCC target.

All seven corners assemble clean: M0+ soft-float (freestanding and quant), M4
hard-float (float, quant, fp16+quant), M33 hard-float (freestanding and quant).

Verified to be genuinely cross-compiling rather than silently building for the
host, which is the way a gate like this fails quietly: the emitted object is
"ELF 32-bit LSB relocatable, ARM, EABI5", and a translation unit asserting
sizeof(void*)==8 compiles on the host clang and fails under the target flags.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019tVgXeXCcfbHqfMjhufWzd
@danmcleran
danmcleran merged commit 4159cb6 into master Aug 31, 2026
24 checks passed
@danmcleran
danmcleran deleted the ci/clang-arm-crosscompile branch August 31, 2026 00:07
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.

1 participant