ci: cross-compile the Cortex-M corners with clang as well as GCC - #176
Merged
Merged
Conversation
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
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.
Closes the second of the two gaps flagged after #175 — the Arm cross-compile edge.
Why
arm_crosscompileproves the headers assemble for a Cortex-M witharm-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-eabiGCC ones thatarm_crosscompilealready requires. The include list is queried from that compiler rather than hardcoded, so the13.2.1in those paths cannot rot across toolchain versions.-fno-exceptions -fno-rttimatches 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:
FLOAT=1Verified it isn't silently building for the host
That is exactly how a cross-compile gate fails quietly, so I checked rather than assumed:
ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV)sizeof(void*)==8compiles under host clang and fails under the target flagsNew 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/ninjaare 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