Skip to content

Latest commit

 

History

History
545 lines (470 loc) · 31.8 KB

README.md

File metadata and controls

545 lines (470 loc) · 31.8 KB

fullrust toolchain — forking Rust for a libc-free static target

This directory builds a fork of the Rust toolchain that adds a built-in target, x86_64-unknown-linux-fullrust, whose std is implemented on raw Linux syscalls (no libc, no C runtime, no dynamic linker). With this toolchain an unmodified crate (fn main, use std::…, no attributes, no deps changes) compiles to a single statically-linked, libc-free ELF — on a pinned released version of Rust, not a floating nightly.

This is the "ship a toolchain fork" path (Approach A): a real std::sys::pal backend, which is also the artifact that could eventually be upstreamed as a Tier-3 target.

Why a distinct target_os = "fullrust"

std selects its platform layer in library/std/src/sys/pal/mod.rs with #[cfg(unix)] first. Any unix-family target is forced onto the libc-based unix pal. To own our pal we must therefore be a non-unix OS — exactly how hermit/wasi/uefi/sgx do it. So:

  • Triple name: x86_64-unknown-linux-fullrust (the linux signals the kernel ABI).
  • os = "fullrust", not in the unix family → std falls through to our pal, and to the unsupported shims for everything we haven't implemented yet.
  • llvm_target = "x86_64-unknown-linux-gnu" → codegen, TLS model and syscall ABI are byte-for-byte the normal Linux x86-64 ones.

The kernel-facing code is reused from purestd (the raw-syscall layer + arch files); std's File/TcpStream/etc. are built on top of the pal primitives, so we port the bottom of purestd, not its high-level modules.

Changes applied to a clean Rust checkout

Compiler (target registration):

  • compiler/rustc_target/src/spec/base/fullrust.rs — new: base TargetOptions (libc-free, static, panic=abort, rust-lld, not unix family).
  • compiler/rustc_target/src/spec/base/mod.rs — register mod fullrust;.
  • compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_fullrust.rs — new: the target.
  • compiler/rustc_target/src/spec/mod.rs — list it in supported_targets!.

Bootstrap:

  • src/bootstrap/src/utils/cc_detect.rs — probe C compilers for the fullrust target using the equivalent …-linux-gnu triple (cc-rs can't parse the fullrust env). The compiler is recorded but never used — the target is C-free.
  • bootstrap.toml — build config (see below).

std (the pal backend) — in progress:

  • library/std/src/sys/pal/fullrust/ — new: the platform layer (_start, process exit/abort, stdio, time, args, …), delegating to raw syscalls.
  • library/std/src/sys/pal/mod.rs and the sys/{stdio,args,alloc,random,…} dispatchers — add a fullrust branch (real where implemented, else unsupported).

bootstrap.toml notes

  • download-ci-llvm = false — CI LLVM artifacts expire for old release tags (404), so LLVM is built from source once, with only the backends the fullrust targets need (targets = "X86;AArch64;ARM"). bootstrap's LLVM stamp ignores llvm.targets, so build-fork.sh checks llvm-config --targets-built and forces a reconfigure when a cached LLVM lacks a needed backend.
  • optimized-compiler-builtins = false — use pure-Rust intrinsics; avoids cc-rs and keeps the target genuinely C-free.
  • rust.lld = true, llvm-tools = true — ship rust-lld (the target's linker).

Building

The fork's source changes are kept out of tree as a patch overlay so they survive independently of the (gitignored) checkout:

  • patches/fullrust-<minor>.patch — the full source overlay (target spec, pal, and the build.rs/cc_detect/compile.rs/dispatcher edits).
  • bootstrap-<minor>.toml — the build config.

Automated flow (clone → apply overlay → build):

./build-fork.sh 1.100.0         # clones rust-1.100, applies overlay, builds host std
                                # + std for EVERY fullrust target the overlay registers
FULLRUST_TARGETS=x86_64 ./build-fork.sh 1.100.0   # quicker local build: a subset
./run-tests.sh 1.100            # the CI test gate, x86_64
./run-tests.sh 1.100 --target all            # … for every target built (what CI runs)
./run-tests.sh 1.100 --target armv7 test-hello
./link-and-test.sh 1.100 [aarch64]           # rustup-links the toolchain, runs test-hello

Targets are named by triple or alias (x86_64, i686, aarch64, armv7); toolchain/targets.sh holds the shared logic. Which fullrust targets a minor has is never hardcoded: the build takes whatever the overlay registers in supported_targets!, the tests whatever std was built for — so a minor whose overlay predates a target keeps building.

Running the non-x86 targets. x86_64 and i686 run natively on an x86-64 host (i686 needs the kernel's IA-32 emulation, on by default). aarch64 and armv7 run under qemu-user; the scripts pick, in order: cargo's CARGO_TARGET_<TRIPLE>_RUNNER, a registered binfmt_misc qemu-<arch> handler (direct exec — CI uses this), then a qemu binary in $FULLRUST_QEMU_DIR, ~/.local/qemu/qemu-{aarch64,arm} or qemu-<arch>[-static] on PATH. Without binfmt_misc, tests that re-exec their own binary (test-regress's exit codes, test-syscall) fail, since qemu-user can't follow an execve of a foreign binary; register the handler once (as root) to fix that, e.g. echo ':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:'"$HOME"'/.local/qemu/qemu-aarch64:F' > /proc/sys/fs/binfmt_misc/register (Debian's qemu-user-static/qemu-user + binfmt-support packages do it for every arch). armv7 is panic = abort: crates that need unwinding (test-unwind) and test-backtrace's after-panic checks are skipped there (detected from the target spec's panic-strategy, not hardcoded).

Manual equivalent:

cd rust-1.100
BOOTSTRAP_SKIP_TARGET_SANITY=1 \
  python3 x.py build library --target x86_64-unknown-linux-fullrust --stage 1
rustup toolchain link fullrust-1.100 build/x86_64-unknown-linux-gnu/stage1
cargo +fullrust-1.100 build --target x86_64-unknown-linux-fullrust --release

BOOTSTRAP_SKIP_TARGET_SANITY=1 is needed because the downloaded stage0 compiler predates the new target.

To build real third-party crates (anything with a build.rs or a proc-macro dependency — serde, syn, …), the sysroot also needs host std, since build scripts and proc-macros compile for the host. Build all targets in one invocation so they all live in the sysroot (building a subset alone drops the others) — build-fork.sh does exactly this:

BOOTSTRAP_SKIP_TARGET_SANITY=1 python3 x.py build library --stage 1 \
  --target x86_64-unknown-linux-gnu,x86_64-unknown-linux-fullrust,aarch64-unknown-linux-fullrust,i686-unknown-linux-fullrust,armv7-unknown-linux-fullrusteabihf

To regenerate the overlay after editing the rust tree:

./regen-overlay.sh 1.100

This captures both the main-repo edits and the edits inside the vendored submodules the overlay patches (library/backtrace, library/stdarch). A superproject git diff only sees submodule pointers, so those submodules are diffed inside themselves and path-prefixed back to the superproject root; the combined patch applies with a single git apply (which build-fork.sh runs after git submodule update --init-ing those two submodules). Verify the regenerated patch is exact with git -C rust-1.100 apply --check --reverse "$PWD/patches/fullrust-1.100.patch".

Docker image

A prebuilt image (ghcr.io/karpeleslab/fullrust) turns any Cargo project into a static, libc-free x86_64-unknown-linux-fullrust binary — or an aarch64-unknown-linux-fullrust, i686-unknown-linux-fullrust or armv7-unknown-linux-fullrusteabihf one — with no local toolchain setup. It bundles the patched stage1 compiler (the fullrust targets are compiled in, with a std sysroot for each), the ecosystem bundle (getrandom, rustix, mio, tokio, socket2), and qemu-aarch64/qemu-arm (from Debian's static qemu-user) as cargo's runner for those two targets, so cargo run/cargo test work for every target. /opt/fullrust/targets lists the targets the image has (older images: x86_64 only and no such file).

The compiler, the default target, the ecosystem [patch.crates-io], and RUSTC_BOOTSTRAP are baked into the image env + cargo config, so a plain cargo build inside the image already produces the fullrust build — your Cargo.toml is never touched. That is deliberate: it makes the two ways of using the image produce the identical build.

1. docker run (or the reusable action):

docker run --rm -v "$PWD:/src" ghcr.io/karpeleslab/fullrust:latest            # build --release
# → target/x86_64-unknown-linux-fullrust/release/<bin>  (statically linked, no libc)
docker run --rm -v "$PWD:/src" ghcr.io/karpeleslab/fullrust:latest test
docker run --rm -v "$PWD:/src" -it ghcr.io/karpeleslab/fullrust:latest bash   # escape hatch

The first positional arg is a cargo subcommand (build/test/run/…); anything else (e.g. bash) runs verbatim. FULLRUST_NO_ECOSYSTEM=1 builds against the pristine upstream crates; CARGO_BUILD_TARGET overrides the triple (default x86_64-unknown-linux-fullrust; a fullrust triple the image lacks is rejected with the list it has):

docker run --rm -v "$PWD:/src" -e CARGO_BUILD_TARGET=aarch64-unknown-linux-fullrust \
    ghcr.io/karpeleslab/fullrust:latest                     # → target/aarch64-unknown-linux-fullrust/release/
docker run --rm -v "$PWD:/src" -e CARGO_BUILD_TARGET=armv7-unknown-linux-fullrusteabihf \
    ghcr.io/karpeleslab/fullrust:latest test                # tests run under the bundled qemu-arm

In another repo's workflow this is just uses: KarpelesLab/fullrust@… with an optional target: input (see action.yml).

2. GitHub container: job — run the whole job inside the image (no docker-in-docker; most efficient for a repo's own CI):

jobs:
  build:
    runs-on: ubuntu-latest
    container: ghcr.io/karpeleslab/fullrust:latest
    steps:
      - uses: actions/checkout@v6
      - run: cargo build --release        # same fullrust build as `docker run` above

The raw cargo build gets rustc, the target, and the patches from the image env

  • config — identical to method 1. The image ships Node.js 24, so JS actions like actions/checkout@v6 run in-container as usual.

How the image is built. It's a packaging image (debian-slim + host cc + node + the ecosystem bundle), and it downloads a prebuilt stage1 rather than building from source — same idea as KarpelesLab/decryptd's container. This splits into two CI workflows (repo root .github/workflows/):

  • fullrust toolchain — the slow, rare half: builds the stage1 from source (LLVM + rustc, ~1–2 h) with std for the host and every fullrust target, gates on ./run-tests.sh <minor> --target all (x86_64/i686 natively, aarch64/armv7 under qemu-user via binfmt_misc), and attaches fullrust-toolchain-<minor>-x86_64.tar.gz (stage1 with all sysroots + bootstrap cargo; x86_64 is the host) to a toolchain-<minor> release whose body lists the targets. Run once per Rust version (docker/package-toolchain.sh makes the tarball). Versus x86_64 alone, the extra targets cost the AArch64 + ARM LLVM backends (~15–25% more on a cold LLVM build, cached after), ~3 more std builds and the qemu test runs — roughly +15–30 min per toolchain build, on the same single runner.
  • fullrust image — the fast half: docker/build-push-action builds the Dockerfile (which curls that release asset via FULLRUST_TOOLCHAIN_URL) and pushes ghcr.io/<owner>/fullrust:<minor>,:latest. Re-runs on every ecosystem change — a seconds-long repackage, no compiler rebuild. Its verify job builds and cargo runs a serde probe for every target in /opt/fullrust/targets.
  • upstream watch — daily: when upstream ships a new point release of a minor we have an overlay for (e.g. 1.99.1 → 1.99.2), it dispatches fullrust toolchain for it (which then rebuilds that minor's image); when it ships a new minor with no patches/fullrust-<minor>.patch, it opens a "Port fullrust to Rust " issue. It also runs when an overlay lands on master: it dispatches the first build of a newly ported minor, and rebuilds any published minor whose overlay changed (each toolchain-<minor> release body records overlay <hash>, a sha256 of the patch + bootstrap config), so a std fix only needs committing. A version it already dispatched (any outcome) is never re-dispatched, so a failed build waits for a manual re-run.

Locally: ./build-fork.sh 1.100.0, then ./docker/build-image.sh 1.100 <tag> (packages the stage1 and serves it over localhost so the same URL-based Dockerfile works unchanged). See docker/.

Status

Rust 1.88 — milestone 1 + threads + native TLS + fast allocator. An unmodified crate (fn main, use std, println!, BTreeMap, env::args) builds with the fork and runs as a statically-linked, libc-free ELF (~44 KB): no INTERP segment, no NEEDED entries, no libc/GLIBC symbols; strace shows raw write/exit_group syscalls.

Threads work too. thread::spawn/join, Arc<Mutex> under contention, and thread_local! all run correctly on a static libc-free binary: an 8-thread × 100k-iteration contended-counter test lands 800000/800000 with per-thread TLS verified, available_parallelism() reports the real CPU count.

Native %fs TLS. Thread-locals are real ELF #[thread_local] (local-exec model), not a registry: the pal sets up a variant-II TCB and installs %fs for the main thread (arch_prctl after parsing PT_TLS from the auxv) and for spawned threads (CLONE_SETTLS), so a thread-local access is a single mov. has_thread_local = true; the old (tid,key) BTreeMap registry is gone. Thread-local destructors now run at thread exit (the pal calls destructors::run + rt::thread_cleanup, hermit-style). See sys/pal/fullrust/tls.rs.

mimalloc-class allocator. The System allocator is a per-thread, free-list- sharded heap (sys/pal/fullrust/heap.rs): 4 MiB aligned segments sliced into 64 KiB size-class pages, a lock-/atomic-free owner fast path reached in two loads off %fs, atomic thread_free lists for cross-thread frees, abandoned-segment reclamation on thread exit, and OS purging via madvise(MADV_FREE)/munmap. Free is routed entirely by Layout (no per-allocation header). Versus the old page-per-mmap allocator on a 32-core box: ~235× faster single-thread (2879 → 12 ns/op), near-linear multicore scaling (0.16 → ~1800 M ops/s at 32 threads), and fragmentation overhead cut 1.43× → 1.08×. A debug-assertion-gated integrity check rejects double/foreign/use-after-frees at zero release cost.

Implemented std::sys::pal::fullrust: _start, raw syscalls (the machine code — syscall instruction, _start, clone trampoline, thread pointer, sigreturn — is per architecture in pal/fullrust/arch/), process exit/abort, clock_gettime time, sleep/yield, args (lossy-UTF8), stdio read/write, getrandom, the mimalloc-class allocator above, threads (clone(2) musl-style trampoline + CLONE_CHILD_CLEARTID join handshake), futex-based sync (Mutex/Condvar/RwLock/Once/parking), and native %fs thread-locals. strlen is provided in the pal; mem* come from compiler-builtins-mem (enabled for the target in std_cargo).

Full std subsystems on raw syscalls (no libc): std::env (loader-envp backed vars + cwd + current_exe), std::fs (File/metadata via statx/dir iteration via getdents64/the *at family — read, write, seek, permissions, symlinks, hard links, canonicalize, copy, file locks, recursive removal), std::process (Command via fork+execve with PATH search, pipe stdio, concurrent stdout/stderr capture, wait4 exit status, signals), and std::net (TCP/UDP on the socket syscalls + a self-contained DNS resolver: /etc/hosts + /etc/resolv.conf + UDP A/AAAA queries). Each has a dedicated test-* crate.

Polish closing the remaining gaps: strerror-quality io::Error messages (errno→text table, since there's no libc strerror), is_terminal via ioctl(TCGETS), env::split_paths/join_paths/home_dir ($HOME), thread::set_name via prctl(PR_SET_NAME), real vectored I/O (readv/ writev for File/TcpStream/pipes — IoSlice now lowers to a kernel iovec), and proper SIGPIPE handling: startup honors the compiler's -Zon-broken-pipe directive (default SIG_IGN so a write to a closed peer returns EPIPE; kill→SIG_DFL, inherit, error all respected), and the fork+execve child restores SIG_DFL before exec so spawned Unix tools terminate on a broken pipe as expected. Covered by test-osextra.

Extra changes beyond the target spec / pal: build.rs (check-cfg + restricted_std allowlist), cc_detect.rs (probe via the gnu triple), compile.rs (compiler-builtins-mem), the sys/{stdio,args,random,alloc,thread_local} dispatchers, fullrust branches in the sys/{fs,net,process,env,path,io} + sys/sync/* + thread_local guards, and a real fd-backed pal::pipe. File, AnonPipe, and the socket layer all wrap one shared pal::fd::FileDesc (owned fd

  • read/write/vectored/dup/close), and the raw mmap/munmap/madvise and program-header readers live once in the pal root — so the syscall plumbing has a single home rather than a copy per subsystem.

The allocator now has three paged tiers plus a huge fallback: small (≤8 KiB, 64 KiB pages), medium (8–128 KiB, 512 KiB pages) and large (128–512 KiB, whole-4 MiB page), all reusing the same sharded free-list / cross-thread / reclaim machinery parameterized by segment kind, with a committed empty-segment cache (≈14–24 ns/op alloc+free churn vs ~5 µs for the old per-op mmap). Over-aligned requests (align > 16) route to power-of-two classes. Free stays header-free (masks to the segment and reads its stored kind). A thread-exit scavenge folds and unmaps abandoned segments emptied by cross-thread frees. Huge allocations (>512 KiB, page-aligned) go through a per-thread reuse cache: on free the mapping is MADV_DONTNEED'd (so it holds no RSS yet re-faults as zero, keeping alloc_zeroed correct) and parked by page-length for reuse, so repeated large-buffer churn avoids the mmap/munmap pair (and its mmap_lock / TLB-shootdown cost) — only over-aligned or un-cacheable huge requests hit the OS each time. Design chosen and reviewed via multi-agent design panel + adversarial correctness review.

Known limitations (next steps)

  • Allocator: the per-thread huge cache is not shared across threads, so a producer/consumer huge pattern (alloc on A, free on B) reuses less than same-thread churn. Abandoned segments are reclaimed on demand or at any thread exit; a segment of a kind that is never re-allocated and with no further thread exits can linger (bounded, mimalloc-style). Unwinding. The target defaults to panic = unwind, with a pure-Rust DWARF unwinder (no libgcc/libunwind, no libc): the in-tree unwinding crate — already a std dependency for xous — is routed to fullrust in library/unwind and library/panic_unwind (the gcc.rs Itanium backend + rust_eh_personality). Its one platform hook is finding .eh_frame: sys::pal::fullrust::eh_frame registers a custom FDE finder that locates .eh_frame_hdr (PT_GNU_EH_FRAME) and the text segment from the process program headers (captured from the auxv AT_PHDR by tls::init_main) — the libc-free equivalent of dl_iterate_phdr. So catch_unwind catches, RAII Drops run as the stack unwinds, panic payloads propagate, an uncaught panic unwinds out of main and exits 101, a panic during cleanup aborts (correct Rust semantics), and unwinding works across spawned threads — all verified by test-unwind. (-C panic=abort is still honored per crate.)

Diagnostics. Panic backtraces work independently of the unwinder: a frame-pointer stack walker (backtrace/src/backtrace/frameptr.rs, the target forces frame_pointer: Always; _start and the thread trampoline zero %rbp to terminate the chain) feeds gimli/DWARF symbolization that reads /proc/self/exe (a native_libraries loader returns the static non-PIE image at bias 0; the std::fs-based mmap_fake is used since there is no libc mmap), so RUST_BACKTRACE=1 and std::backtrace::Backtrace yield names + file:line. A stack-overflow handler (sys::pal::fullrust::stack_overflow) installs a SIGSEGV/SIGBUS handler on a per-thread alternate signal stack (raw rt_sigaction with a restorer trampoline + sigaltstack); spawned-thread stacks get an mprotect(PROT_NONE) guard page and the main thread's guard is derived from RLIMIT_STACK, so an overflow prints thread '…' has overflowed its stack and aborts while a genuine segfault passes through unchanged.

Real-world validation. Beyond the hand-written test-* crates, real third-party code runs on the target as static, libc-free ELFs:

  • serde + serde_json (test-realworld) — typed + untyped JSON round-trips, pulling serde_derive/syn/proc-macro2 (proc-macros compile for the host).
  • purecrypto (a pure-Rust crypto toolkit) — its CLI builds and runs; SHA-256 and SHA3-256 match the NIST test vectors, and EC P-256 key generation works. Needed only a fullrust OsRng (reads /dev/urandom via std::fs, which is O_CLOEXEC on this target) since it isn't in the unix family.
  • rsurl (a pure-Rust curl) — built HTTP-only, it performs a full GET https://…: DNS via the pal resolver, TCP connect, a purecrypto TLS 1.3 handshake with embedded-root certificate verification, and HTTP/2 — end to end on the from-scratch std, no libc and no OpenSSL. rsurl itself needed no changes.

The recurring friction is that cfg(unix) is false on this target, so a crate's unix-gated (but otherwise portable) code is invisible unless it also has a target_os = "fullrust" path. To make that path a pure cfg broadening, std provides the Unix/Linux extension API on fullrust:

std::os::unix and std::os::linux (Linux-identical APIs). std's own os/unix, os/linux and os/net/linux_ext sources are compiled for fullrust unchanged except for their module gates (every target_os = "linux" gate there becomes any(target_os = "linux", target_os = "fullrust"), so fullrust takes the Linux branches) — cfg(unix) stays false. The libc:: names that code uses come from a std-internal shim, sys::pal::fullrust::libc (Linux x86-64 types, constants, and raw-syscall functions with the C -1+errno convention; errno is a real #[thread_local]), and the sys hooks it calls are implemented in the fullrust pal:

  • unix::fs: PermissionsExt, MetadataExt (FileAttr now carries a Linux struct stat synthesized from statx, so linux::fs::MetadataExt::as_raw_stat works too), OpenOptionsExt (mode, custom_flags), FileExt (pread64/pwrite64/preadv/pwritev), FileTypeExt, DirEntryExt(2), DirBuilderExt, symlink, chown/fchown/lchown, chroot, mkfifo.
  • unix::process: CommandExt (uid, gid, groups, pre_exec, exec, arg0, process_group, chroot, setsid), ExitStatusExt, ChildExt, fd conversions for Stdio/Child*, parent_id. Spawning now mirrors the unix pal exactly, including the CLOEXEC error pipe (a missing program is Err(NotFound), a failing pre_exec closure's error is returned by spawn).
  • unix::net: UnixStream, UnixListener, UnixDatagram, SocketAddr (pathname + abstract), UCred/peer_cred, SocketAncillary (SCM_RIGHTS, SCM_CREDENTIALS).
  • unix::{io, ffi, thread, raw, prelude} (JoinHandleExt::as_pthread_t returns the kernel tid — there is no libpthread).
  • linux::{fs, net (SocketAddrExt, UnixSocketExt, TcpStreamExt), process (PidFd via pidfd_open/waitid/pidfd_send_signal, create_pidfd), raw}.

The older fullrust-specific paths keep working as aliases of the same items: std::os::fullrust::{ffi, io, process} re-export std::os::unix::{ffi, io, process} (one trait identity, so importing both never conflicts), and std::os::fullrust::syscall stays the escape hatch for everything std does not wrap (syscall0..syscall6 -> io::Result<usize>, nr::* syscall numbers, errno::*). Covered by test-osunix (which also builds on x86_64-unknown-linux-gnu for parity) and test-syscall.

This surface is carried on every version 1.91–1.100, and each version exposes exactly the os::unix/os::linux API that version's Linux std has. Per-version glue in the fullrust pal: ≤1.93 use sys_common::{AsInner,…} and AnonPipe as the child pipe type (1.94+ use ChildPipe = FileDesc); ≤1.91 define StdioPipes in sys::process, call Socket::new_raw, and take u32 deferaccept; 1.96+ route parent_id through sys::process::getppid; 1.97 adds ChildExt::{send_process_group_signal, kill_process_group}; 1.98 needs BorrowedCursor<'_, u8>, PidFd via sys::process, and explicit expose_provenance() on syscall pointer arguments.

Version matrix

fullrust keeps the 10 newest Rust minors (currently 1.91 … 1.100) and follows how std::sys::pal shifts across them (the pal interface is deliberately unstable upstream). Porting a new minor drops the oldest: git rm its overlay + bootstrap config. A dropped minor keeps its last toolchain-<minor> release and :<minor> image, but is no longer rebuilt. Each rust-<v> checkout is gitignored; the overlay of source changes above is what we carry forward and re-apply per version (git apply --reject patches/fullrust-<prev>.patch, fix the rejects, ./regen-overlay.sh <v>).

Every minor ships x86_64; a minor ships the other fullrust targets once its overlay registers them (the release body and /opt/fullrust/targets list them).

Rust overlay status
1.91 patches/fullrust-1.91.patch builds + all test crates green
1.92 patches/fullrust-1.92.patch builds + all test crates green
1.93 patches/fullrust-1.93.patch builds + all test crates green
1.94 patches/fullrust-1.94.patch builds + all test crates green
1.95 patches/fullrust-1.95.patch builds + all test crates green
1.96 patches/fullrust-1.96.patch builds + all test crates green
1.97 patches/fullrust-1.97.patch builds + all test crates green
1.98 patches/fullrust-1.98.patch builds + all test crates green
1.99 patches/fullrust-1.99.patch builds + all test crates green (built from 1.99.1; LLVM 23)
1.100 patches/fullrust-1.100.patch builds + all test crates green

1.88–1.90 were dropped when 1.100 landed (their overlays are in git history; the pre-matrix 1.88 original is frozen on the 1.88 branch). The drift notes below keep their history.

1.88 → 1.89 drift was small: only 7 hunks rejected on re-apply — all mechanical Cargo.toml libc-gate edits (dependency version bumps) + one moved function in cc_detect.rs; panic_abort's libc became target_os = "android"-only so that edit is now a no-op. Two build-surfaced pal adaptations: sys::fs::File gained a size() -> Option<io::Result<u64>> (a read_to_end size hint), and Thread::new gained a name: Option<&str> parameter (the child sets it via prctl before running the closure).

1.95 → 1.98 drift:

  • 1.96 moved getcwd/chdir/current_exe/home_dir/temp_dir/path splitting out of each pal's os.rs into a new sys/paths dispatcher (fullrust re-exports its pal os implementations there), and process::id() now comes from the process backend's getpid.
  • 1.97 requires Command::get_resolved_envs and TcpStream::{set_,}keepalive from every backend.
  • 1.98 moved IoSlice and io::Error into core::io (fullrust joins core's repr_iovec list), made BorrowedCursor generic (BorrowedCursor<'_, u8>), sealed the os::*::process extension traits with pub impl(self) trait instead of Sealed, and started denying implicit_provenance_casts, so syscall pointer arguments are passed as ptr.expose_provenance().

1.98 → 1.99 drift (1.99 is on LLVM 23, so no LLVM reuse from 1.95–1.98):

  • library/unwind dropped its unwinding.rs backend; Xous (and now fullrust) use the pure-Rust unwinding crate through libunwind.rs.
  • The allocator interface became free functions (sys::alloc::{alloc, alloc_zeroed, dealloc, realloc}) instead of a per-platform GlobalAlloc for System impl.
  • Futexes moved to a sys/sync/futex dispatcher (fullrust re-exports its pal futex there).
  • set_permissions_nofollow became per-platform (imp::set_perm_nofollow): fullrust uses fchmodat2(AT_SYMLINK_NOFOLLOW) (Linux 6.6+), falling back to glibc's race-free O_PATH|O_NOFOLLOW + /proc/self/fd chmod.
  • io::error grew its own platform dispatcher.

The toolchain workflow now builds the newest point release of a minor (1.99 → 1.99.1) unless an exact version is given.

1.99 → 1.100 drift was small: the 12 rejected hunks were the formatting of upstream's rustfmt'd cfg_select! blocks plus bootstrap's Build → Session rename in cc_detect.rs. The one API change: sys::io now wants format_error(errno, &mut Formatter) instead of error_string(errno) -> String, so the pal's errno table writes into the formatter (no allocation). Versions sort with sort -V everywhere (workflows, latest), so 1.100 orders after 1.99.

libm (all versions): fullrust's sin/cos/pow/… come from the pure-Rust libm that compiler-builtins compiles in, but compiler-builtins gives only part of it a C name. With an x86_64-unknown-linux-gnu LLVM target, LLVM and crates assume glibc's full libm (LLVM folds sin(x) + cos(x) into sincos), so those failed to link. gen-libm-exports.py rust-<minor> writes a fullrust-only block into that tree's compiler-builtins/src/math/mod.rs exporting every remaining libm function (42–50 depending on the version) with its C signature, tuple returns becoming out-pointers (frexp, modf, remquo, sincos). It reads that version's own libm, so re-run it when porting (it replaces its own block), then ./regen-overlay.sh. test-regress checks the folded sincos and a sample of the C-ABI functions.

Architectures (1.100+): besides x86_64 the overlay has aarch64-unknown-linux-fullrust, i686-unknown-linux-fullrust and armv7-unknown-linux-fullrusteabihf. Everything machine-specific in the pal is in library/std/src/sys/pal/fullrust/arch/<arch>.rs (syscall instruction, _start, the clone trampoline, thread pointer read/install, sigreturn trampoline, si_addr offset). TLS is variant II on x86 (%fs/%gs, the TCB at the thread pointer; i386 gets its %gs GDT slot from set_thread_area) and variant I on ARM (tpidr_el0/TPIDRURO, our TCB just below the thread pointer). pal::sysc hides the rest: on 32-bit targets the portable names map to the 64-bit-time / 32-bit-uid syscalls (CLOCK_GETTIME64, FUTEX_TIME64, MMAP2, GETUID32, …) and helpers split 64-bit offsets into register pairs (even-aligned on ARM EABI); AArch64's missing legacy calls go through dup3/ppoll/clone/readlinkat. std::os::fullrust::syscall::nr is each architecture's own kernel table, generated by gen-syscall-nr.py /usr/src/linux rust-<minor>. armv7 is panic=abort: 32-bit ARM unwinds with EHABI, which the pure-Rust unwinding crate lacks.

Build tip: a released tag's CI LLVM is usually expired (download-ci-llvm 404s), so LLVM builds from source (~1–2 h). Adjacent versions often share an LLVM major — you can reuse an already-built LLVM via [target.<host>] llvm-config = ".../rust-<prev>/build/.../llvm/bin/llvm-config", but then bootstrap won't copy rust-lld into the sysroot, so copy it (and gcc-ld/) from the previous stage1 by hand — again after every rebuild, since bootstrap re-assembles the sysroot without them. The canonical from-source build (what CI does) needs neither.