Skip to content

Expand FreeBSD sys support and strengthen platform regression coverage - #502

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
LunaStev:fix/platform-support-followups
Sep 7, 2026
Merged

Expand FreeBSD sys support and strengthen platform regression coverage#502
LunaStev merged 1 commit into
wavefnd:masterfrom
LunaStev:fix/platform-support-followups

Conversation

@LunaStev

@LunaStev LunaStev commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Expand FreeBSD std/sys to amd64, arm64 and riscv64 with direct kernel syscalls, and replace shallow platform cases with functional workloads that exercise the compiler and OS providers together.

  • Register FreeBSD arm64/riscv64 targets, C ABI classification and ELF link plans. Share LP64 filesystem, memory, process, time, socket, tty and environment implementations while preserving existing module paths.
  • Correct FreeBSD syscall return registers, the 64-byte kevent layout and event error handling. Use direct syscalls for kqueue, scatter/gather I/O, page-size discovery and environment access.
  • Rewrite 479 existing cases in place across 49 directories, add ten shared algorithm workloads and six FreeBSD integration cases, and make the refresh tool update existing generated cases without filling quotas. Workloads include a stack VM, stable aggregate sorting, graph routing, hash tables, packet coding, multiprecision arithmetic, arenas, scheduling, convolution and recursive trees.
  • Fix comparison/generic lookahead, indexed struct rvalue loads, nested field type preservation and typed inline-assembly input evaluation exposed by these workloads.
  • Add executable LoongArch64 LP64S C interoperability coverage, a shared Windows std-directory fallback to USERPROFILE, and corresponding CI coverage.
  • Remove the undefined K-RISC-V manifest entries and 20 associated cases. Other existing case paths are retained, and the cases README stays brief.

Motivation

Platform support needs executable behavior checks rather than assembly-only placeholders. These workloads exposed parser/codegen defects and missing FreeBSD kernel contracts; this change fixes them and adds regression coverage.

Closes #481
Closes #491
Closes #492
Closes #500
Closes #501

Target and compatibility impact

  • New FreeBSD targets are aarch64-unknown-freebsd and riscv64-unknown-freebsd. FreeBSD RISC-V requires LP64D, including when ABI selection is inferred from target features.
  • The new FreeBSD providers and VM test executables do not link libc. Existing resolver/interface bindings elsewhere are outside this patch.
  • Windows GNU and the LoongArch backend remain available. LP64S interoperability is tested freestanding; this does not claim hosted glibc LP64S support.
  • FreeBSD arm64/riscv64 CI lanes compile the cases. Runtime verification was performed locally in official FreeBSD VMs using the included runner; native macOS and Windows checks await PR CI.
  • OpenBSD, NetBSD, DragonFly and MSVC expansion remain separate work. Disabled future-platform cases do not imply native OS support.
  • No dependency or license-boundary changes.

Validation

Passed locally:

  • cargo fmt --all --check
  • ./tools/check_std_policy.sh
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --no-deps --jobs 2
  • cargo clippy --locked --workspace --all-targets --jobs 2 -- -D warnings
  • cargo test --locked --workspace --all-targets --jobs 2
  • cargo test --locked --no-default-features --features llvm-target-core64 --jobs 2 (57 codegen regressions)
  • cargo build --locked --release --jobs 2
  • python3 tools/check_wave_corpus.py --wavec target/release/wavec --run-std-examples: 272 corpus entries and all 26 std examples passed. Socket examples required execution outside the restricted sandbox.
  • Python tooling syntax checks, 17 tooling unit tests, 39-target manifest validation, workflow YAML checks and git diff --check.
  • FreeBSD 14.3 amd64/arm64/riscv64 VMs: all 12 cases per architecture at O0/O2, 72 successful executions, statically linked without libc. Official images and the RISC-V kernel were SHA256-verified. tools/check_freebsd_sys.py reproduces these checks with supplied images.
  • 489 rewritten/new workload sources emitted objects; 44 native amd64, 134 AArch64/RISC-V64/LoongArch64 QEMU, and 120 WebAssembly workload executions passed. Disabled OS cells were object-checked against their base ISA only.
  • LoongArch64 LP64S and LP64D C interoperability executed under QEMU. FreeBSD IR/object regressions check raw syscall dependencies, kernel layouts and link plans; Clang C ABI comparisons cover all three FreeBSD targets.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates.
  • The change preserves the license boundary between the compiler and std/.

Signed-off-by: LunaStev <luna@lunastev.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment