Skip to content

Distribution: platform matrix — linux/arm64 first (per-arch helper cache, CI on an arm64 runner or QEMU), then macOS arm64; a target-triple abstraction in Linker/TargetMachine instead of x86_64 assumptions (prelinked/helper-runtime/<arch>/, lib/AOT/Linker.php, lib/JIT/Context.php) #36391

Description

@PurHur

Category

Foundation: · portability · child of #36379

Why

prelinked/helper-runtime/ has exactly one directory: x86_64-linux. The object emit uses MCJIT defaults for the host (no explicit triple/CPU, #36200 landed lib gating only), the linker hardcodes crt/ld paths for Ubuntu 22.04 x86_64, and the Docker image is x86_64 only. Every developer laptop is arm64 now and Graviton is the cheapest cloud CPU; a compiler that runs on one architecture is a demo.

Deliverable

  1. Target abstraction: PHP_COMPILER_TARGET=x86_64-linux|aarch64-linux|aarch64-darwin selects triple, CPU (generic), reloc model, data layout, Linker toolchain paths, and the helper-cache directory; emitted objects are deterministic per target (Build: every AOT binary links libsodium/libargon2/libbz2/libcrypto/libz/libpcre2 unconditionally, and every compiler process re-parses an 816 KB LLVM FFI header (lib/AOT/Linker.php, vendor/ircmaxell/php-llvm/ffi/llvm9.php) #36200 reproducibility item).
  2. aarch64-linux: build the dev image for arm64 (docker buildx --platform linux/arm64), emit and commit/publish the helper cache for it, run aot-smoke + differential sweeps on an arm64 runner (GitHub-hosted arm64 or QEMU with a longer timeout) weekly.
  3. aarch64-darwin: LLVM 9 on macOS is hard; evaluate whether this waits for the LLVM 22 migration (Foundation: LLVM 9 → 22 migration Phase 0 — prove the FFI binding can be generated against LLVM 22 headers and thread pointee types on LLVM 9 (docs/roadmap/LLVM22-MIGRATION.md) #36220) — record the answer in the ADR.

Done when

  • aot-smoke.sh 9/9 on linux/arm64 in CI; helper cache published for both arches; ghcr.io/purhur/phpc is multi-arch
  • Target triple, CPU and toolchain are data, not code paths; phpc doctor prints the target

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions