Skip to content

Fix the Linux ARM64 JIT crash and GCC 14 build, and test ARM64 natively in CI - #4

Merged
levkropp merged 3 commits into
masterfrom
fix/linux-arm64-gcc14
Nov 6, 2026
Merged

levkropp merged 3 commits into
masterfrom
fix/linux-arm64-gcc14

Conversation

@levkropp

@levkropp levkropp commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Two bugs on master that CI couldn't see, plus a job that covers them. Both were found while testing #3 on Linux ARM64.

Changes

  • GCC 14 build: a default build fails at src/rom_stubs.c:2064 with -Werror=stringop-truncation. It's a false positive, so nvs_alloc now uses snprintf.
  • JIT crash: jit.c only invalidated the instruction cache on Apple, so on Linux ARM64 the suite died with Illegal instruction at the first test that ran compiled code. Block emission and chain patching now share one helper that uses __builtin___clear_cache off Apple.
  • CI: a new unit tests (aarch64, gcc-14) job on ubuntu-24.04-arm, because ARM64 was only cross-compiled before. The cross-compile job stays, though it's now largely redundant.

Testing

I ran CI's build, unit and CLI trace steps with strict flags on this branch:

Environment Unit suite CLI trace
Linux ARM64, GCC 14.2 (Debian trixie container) 1,095 tests, 39,626 passed, 0 failed pass
macOS ARM64, Apple clang 1,095 tests, 39,626 passed, 0 failed pass

Before these changes, the same Linux setup failed to build, and with only the rom_stubs.c fix the unit suite crashed with Illegal instruction.

This branch doesn't include #3. The Linux run was in a VM on Apple Silicon, so this PR's new job is the first run on a real ARM64 Linux runner.

🤖 Generated with Claude Code

levkropp and others added 3 commits November 6, 2026 17:52
GCC 14.2 at -O3 reports -Werror=stringop-truncation at nvs_alloc's strncpy of
the key, which stops a default build. The warning is a false positive: the
caller's key is at most 15 characters and the field holds 16. snprintf states
the same bounded, terminated copy without tripping it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ARM64 instruction caches are not coherent with data writes, but only the Apple
path invalidated after emitting a block or patching a chain site. On Linux
ARM64 the CPU could execute stale bytes, and the unit suite died with SIGILL at
the first test that ran compiled code.

Route both mutation paths through one helper that uses
__builtin___clear_cache off Apple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI only cross-compiled the arm64 JIT backend, so code that built but crashed
at runtime went unnoticed. Add a job on an ARM64 runner with gcc-14, which also
covers warnings the default gcc does not raise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@levkropp
levkropp force-pushed the fix/linux-arm64-gcc14 branch from dc5db36 to ab9c400 Compare November 6, 2026 22:52
@levkropp
levkropp merged commit e2b79fc into master Nov 6, 2026
6 checks passed
@levkropp
levkropp deleted the fix/linux-arm64-gcc14 branch November 6, 2026 22:54
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