Skip to content

v1.1.3: portable-atomic polyfill for mipsel-softfloat (real fix this time)#46

Merged
therealaleph merged 1 commit into
mainfrom
release/v1.1.3
Apr 23, 2026
Merged

v1.1.3: portable-atomic polyfill for mipsel-softfloat (real fix this time)#46
therealaleph merged 1 commit into
mainfrom
release/v1.1.3

Conversation

@therealaleph
Copy link
Copy Markdown
Owner

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::AtomicU64 doesn't exist on mipsel because MIPS32 has no native 64-bit atomic instructions.

Fix: swap std::sync::atomic::AtomicU64portable_atomic::AtomicU64 in the two non-gated call sites (src/cache.rs + src/domain_fronter.rs). portable-atomic with the fallback feature 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.rs also uses AtomicU64 but is #![cfg(target_os = "android")] so mipsel-linux-musl never compiles it.

Test plan

  • cargo test --lib on 1.1.3 — 54 passing
  • cargo build --bin mhrv-rs — clean
  • CI mipsel-softfloat green (this is the moment of truth)
  • 12 assets in release (the original 11 + mipsel)

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 therealaleph merged commit 4b57007 into main Apr 23, 2026
@therealaleph therealaleph deleted the release/v1.1.3 branch April 23, 2026 08:23
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.
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