v1.1.3: portable-atomic polyfill for mipsel-softfloat (real fix this time)#46
Merged
Conversation
v1.1.2 reached cargo build inside the mipsel docker this time (YAML-fold bug finally out of the way) and surfaced the real underlying problem: MIPS32 has no native 64-bit atomic instructions, so std::sync::atomic::AtomicU64 doesn't exist on mipsel-unknown-linux-musl. Three call sites (DomainFronter stats counters + the request-cache) failed to resolve the import. Fix: depend on `portable-atomic` with the `fallback` feature and import AtomicU64 from there instead of std. The API is identical (same associated methods, same Ordering accepted), so the two touched files change only the `use` line. On 64-bit targets portable-atomic compiles down to the native 64-bit atomic insns with no overhead; on MIPS32 it uses a global spinlock, which is fine for counter increments that happen a few times per relay. Cache.rs and domain_fronter.rs both updated. No other callers of AtomicU64 in non-cfg-gated code (android_jni.rs has it but is gated `#![cfg(target_os = "android")]`, so mipsel-linux-musl never sees it). `cargo test --lib` / `cargo build` still pass on host.
therealaleph
added a commit
that referenced
this pull request
Apr 25, 2026
v1.1.2 reached cargo build inside the mipsel docker this time (YAML-fold bug finally out of the way) and surfaced the real underlying problem: MIPS32 has no native 64-bit atomic instructions, so std::sync::atomic::AtomicU64 doesn't exist on mipsel-unknown-linux-musl. Three call sites (DomainFronter stats counters + the request-cache) failed to resolve the import. Fix: depend on `portable-atomic` with the `fallback` feature and import AtomicU64 from there instead of std. The API is identical (same associated methods, same Ordering accepted), so the two touched files change only the `use` line. On 64-bit targets portable-atomic compiles down to the native 64-bit atomic insns with no overhead; on MIPS32 it uses a global spinlock, which is fine for counter increments that happen a few times per relay. Cache.rs and domain_fronter.rs both updated. No other callers of AtomicU64 in non-cfg-gated code (android_jni.rs has it but is gated `#![cfg(target_os = "android")]`, so mipsel-linux-musl never sees it). `cargo test --lib` / `cargo build` still pass on host.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v1.1.2 finally got the docker/rustup/cargo plumbing right — and exposed the actual root problem I'd been missing across three retags:
std::sync::atomic::AtomicU64doesn't exist on mipsel because MIPS32 has no native 64-bit atomic instructions.Fix: swap
std::sync::atomic::AtomicU64→portable_atomic::AtomicU64in the two non-gated call sites (src/cache.rs+src/domain_fronter.rs).portable-atomicwith thefallbackfeature polyfills u64 atomics via a spinlock on 32-bit MIPS; on 64-bit / armv7 / everywhere else it compiles down to native instructions with no overhead. API is identical, so nothing else changes.android_jni.rsalso uses AtomicU64 but is#![cfg(target_os = "android")]so mipsel-linux-musl never compiles it.Test plan
cargo test --libon 1.1.3 — 54 passingcargo build --bin mhrv-rs— clean