Skip to content

release, aarch64: add native Linux zigc (v*-zigc.*) release workflow and stage2_aarch64 fixes - #239

Merged
cataggar merged 1 commit into
wazigfrom
feat/zigc-release
Nov 11, 2026
Merged

cataggar merged 1 commit into
wazigfrom
feat/zigc-release

Conversation

@cataggar

Copy link
Copy Markdown
Owner

Summary

Adds native Linux zigc (v*-zigc.*, e.g. v0.17.1-zigc.1) release automation on wazig — building Zig without the LLVM backend (-Denable-llvm=false) using Zig's own self-hosted native backends (-Duse-llvm=false) — along with stage2_aarch64 fixes discovered during native aarch64-linux verification.

Release Workflow & Packaging

  • .github/workflows/build-zigc-release.yml:
    • Triggers on v*-zigc.* tag pushes and workflow_dispatch.
    • Builds a fast LLVM-less stage3-host (-Denable-llvm=false) from host Zig 0.17.1 without downloading any LLVM devkit, then compiles both x86_64-linux and aarch64-linux release prefixes with -Dcpu=baseline -Dflat -Denable-llvm=false -Duse-llvm=false -Doptimize=ReleaseSafe -Dstrip -Dno-langref.
    • Smoke-tests zigc version, zigc env, zigc translate-c, zigc build-exe, zigc test, zigc build, cross-compilation (aarch64-linux / x86_64-linux), and WASI -lc (wasm32-wasi).
    • Publishes unsigned zigc-x86_64-linux-<ver>.tar.zst and zigc-aarch64-linux-<ver>.tar.zst prerelease assets (no .minisig) and verifies coexisting ghr install cataggar/zig@<tag> "?id=cataggar/zig/zigc".
  • scripts/package_zigc_bundle.py & scripts/test_package_zigc_bundle.py:
    • Validates static zero-libc ELF64 binaries (PT_INTERP absent, EM_X86_64 / EM_AARCH64), stages zig -> zigc with full lib/, LICENSE, and README.md (build.zig untouched), rejects .minisig files, and compresses deterministically with zstd -19 --zstd=wlog=23 for ghr compatibility.

stage2_aarch64 & compiler_rt Fixes

  • src/codegen/aarch64/Select.zig:
    • Lower unpacked @Vector .not, .bit_and/.bit_or/.xor, and .splat element-wise so non-power-of-two vectors (such as @Vector(6, usize) in std.Target.Cpu.Feature.Set.removeFeatureSet) do not read past vector elements or emit invalid imms=63 EOR immediates.
    • Copy live f16 source registers before in-place BIC in .abs and pass src_mat.ra in .neg when !fullfp16 (-Dcpu=baseline).
    • Always emit tag stores in .errunion_payload_ptr_set and .optional_payload_ptr_set even when the returned payload pointer is unused (e.g., zero-sized structs in std.process.Preopens.init).
    • Use getPtrConst on LiveRegisters (EnumArray) to avoid 340-byte by-value struct copies in hot register allocation/call/merge loops.
  • lib/compiler_rt.zig, lib/compiler_rt/{memcpy,memmove}.zig:
    • Use usize PreferredLoadStoreElement on stage2_aarch64 and enable memcpyFast / memmoveFast instead of 1-byte memcpySmall / memmoveSmall.

Verification

  • python3 -m unittest discover -s scripts -p 'test_package_*_bundle.py' -v (12/12 passed)
  • Built and packaged both zigc-x86_64-linux-0.17.1-zigc.1.tar.zst (34.8 MiB) and zigc-aarch64-linux-0.17.1-zigc.1.tar.zst (31.3 MiB) natively with -Denable-llvm=false -Duse-llvm=false
  • Passed new regression tests in test/behavior/{vector,floatop,error}.zig and lib/compiler_rt/{memcpy,memmove}.zig under -fno-llvm -target aarch64-linux -mcpu=baseline -OReleaseSafe -fstrip
  • Verified end-to-end smoke suite (zigc translate-c, zigc build-exe, zigc test, zigc build, cross-compile, wasm32-wasi -lc, std.compress.zstd, and local ghr install / ghr uninstall)

@cataggar
cataggar enabled auto-merge (squash) November 11, 2026 20:42
…and stage2_aarch64 fixes

- Add `.github/workflows/build-zigc-release.yml` (for `v*-zigc.*` tags and
  `workflow_dispatch`) to build `zigc-x86_64-linux-<ver>.tar.zst` and
  `zigc-aarch64-linux-<ver>.tar.zst` without LLVM (`-Denable-llvm=false`)
  using Zig's self-hosted native backends (`-Duse-llvm=false -Dcpu=baseline
  -Dflat -Dno-langref -Doptimize=ReleaseSafe -Dstrip`), run smoke tests,
  publish unsigned `.tar.zst` prerelease assets (no `.minisig`), and verify
  coexisting `ghr install cataggar/zig@<tag> "?id=cataggar/zig/zigc"`.
- Add `scripts/package_zigc_bundle.py` and `scripts/test_package_zigc_bundle.py`
  to validate static zero-libc ELF64 binaries (`PT_INTERP` absent, matching
  `EM_X86_64` / `EM_AARCH64`), stage `zig` as `zigc` alongside full `lib/`,
  `LICENSE`, and `README.md`, reject `.minisig` files, and compress
  deterministically with `zstd -19 --zstd=wlog=23`.
- Fix `stage2_aarch64` self-hosted compiler bugs uncovered by native
  `zigc-aarch64-linux` verification:
  - Lower unpacked `@Vector` bitwise `.not`, `.bit_and`/`.bit_or`/`.xor`, and
    `.splat` element-wise so non-power-of-two vectors (such as `@Vector(6, usize)`
    in `std.Target.Cpu.Feature.Set.removeFeatureSet`) do not read past vector
    elements or emit invalid `imms=63` `EOR` immediates.
  - Copy live `f16` source registers before in-place `BIC` in `.abs` and pass
    `src_mat.ra` in `.neg` when `!fullfp16` (`-Dcpu=baseline`).
  - Emit tag stores in `.errunion_payload_ptr_set` and
    `.optional_payload_ptr_set` even when the returned payload pointer is
    unused (zero-sized payload structs such as `std.process.Preopens.init`).
  - Avoid 340-byte by-value `EnumArray.get` copies on `LiveRegisters` in
    `Select.zig` and enable `memcpyFast`/`memmoveFast` with `usize` elements on
    `stage2_aarch64`.
- Update `README.md`, `doc/installation.md`, `doc/building.md`, and
  `.github/*instructions*` for `zigc` (`v*-zigc.*`) releases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cataggar cataggar closed this Nov 11, 2026
auto-merge was automatically disabled November 11, 2026 22:33

Pull request was closed

@cataggar cataggar reopened this Nov 11, 2026
@cataggar
cataggar enabled auto-merge (squash) November 11, 2026 22:33
@cataggar
cataggar merged commit 25c08aa into wazig Nov 11, 2026
2 checks passed
@cataggar
cataggar deleted the feat/zigc-release branch November 11, 2026 22:50
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