aes 0.9 runtime-detects the ARMv8-Crypto backend on aarch64 via `cpufeatures` and polyval 0.7
picks its armv8 PMULL intrinsics by target_arch, so neither cfg exists any more — passing them
is inert. That retires a real footgun rather than tidying a file: a RUSTFLAGS env var overrides
config rustflags ENTIRELY, so every aarch64 lane that set its own (cargo-ndk does so internally
for every Android arm64-v8a build) silently dropped both and ran SOFTWARE AES on the per-packet
decrypt path.
Measured before deleting, `crypto/open_in_place` (1408-byte MTU shard, AES-128-GCM, single core,
Mac15,14 M3 Ultra, four runs back to back under identical background load):
aes 0.8 + both cfgs 2.19 GiB/s
aes 0.8, cfgs stripped 225 MiB/s ~10x cliff — reproduces the recorded ~240 MiB/s
aes 0.9 + both cfgs 5.28 GiB/s
aes 0.9, cfgs stripped 5.28 GiB/s identical to 4 s.f.
The ChaCha20-Poly1305 series of the same bench was the control and moved 0.07% across the cfg
toggle at both versions, so the toggle demonstrably reached only the AES path. A final run with
the flags actually deleted (not merely RUSTFLAGS-overridden) reproduced 5.29 GiB/s.
.cargo/config.toml is kept as a tombstone carrying that table so the flags are not reintroduced.
The two CI comments that warned about losing these cfgs to a RUSTFLAGS override are updated —
mold in ci/cargo-config-mold.toml is now the only thing such an override can cost.
42 lines
2.8 KiB
TOML
42 lines
2.8 KiB
TOML
# Installed as $CARGO_HOME/config.toml in every Linux CI builder image (ci/*.Dockerfile).
|
|
#
|
|
# WHAT: link the x86_64 Linux targets with mold instead of GNU ld. Linking is the one phase of a
|
|
# Rust build that sccache CANNOT cache — every job relinks punktfunk-host, punktfunk-client-linux,
|
|
# punktfunk-client-session, punktfunk-cli, pf-update and punktfunk-encode-worker from scratch on
|
|
# every run, and the packaging legs (deb/rpm/arch) do it for release binaries with full debug info.
|
|
# mold is the only lever that touches that phase.
|
|
#
|
|
# ⚠ THE TRAP THIS FILE HAS TO STAY CLEAR OF — read before editing, and before adding rustflags
|
|
# anywhere else in this repo:
|
|
#
|
|
# 1. A `RUSTFLAGS` ENVIRONMENT VARIABLE OVERRIDES CONFIG RUSTFLAGS ENTIRELY. It does not merge
|
|
# and it does not append. Any job that sets RUSTFLAGS silently loses mold here — it still
|
|
# builds, just with the default linker. Never "simplify" this file into a RUSTFLAGS export.
|
|
# (This trap used to be far worse: the workspace .cargo/config.toml carried aarch64
|
|
# `--cfg aes_armv8` / `--cfg polyval_armv8`, worth ~10x on the decrypt path, and an override
|
|
# dropped those too. The RustCrypto aes 0.9 / polyval 0.7 bump retired both cfgs — see the
|
|
# tombstone in .cargo/config.toml — so today only mold is at stake here.)
|
|
#
|
|
# 2. CONFIG FILES MERGE PER KEY, HIGHEST-PRECEDENCE FILE WINS — they do not concatenate. The
|
|
# workspace's .cargo/config.toml outranks this one ($CARGO_HOME is the LOWEST precedence).
|
|
# Today that is harmless because the workspace file defines NO rustflags at all and this one
|
|
# defines only `target.x86_64-unknown-linux-gnu.rustflags`. But the moment someone adds an
|
|
# x86_64 rustflags entry to the workspace .cargo/config.toml, IT WINS and mold silently stops
|
|
# being used here. If that ever happens, move the link-arg into that file instead of
|
|
# duplicating it.
|
|
#
|
|
# 3. aarch64 IS DELIBERATELY NOT WIRED. The cross image links with aarch64-linux-gnu-gcc against a
|
|
# multiarch sysroot (ci/rust-ci-arm64cross.Dockerfile); pointing that driver at mold is a
|
|
# separate thing to prove, and those legs are already the fast ones (~1.5 min of clippy, ~5 min
|
|
# for the arm64 .deb). Add it only with a measurement, and in a commit of its own.
|
|
#
|
|
# Requires GCC >= 12.1 (or clang) for `-fuse-ld=mold`; every base here ships far newer. mold itself
|
|
# is installed in the same Dockerfile layer that copies this file, so an image can never carry the
|
|
# flag without the linker — see the `mold --version` assertion there.
|
|
#
|
|
# NOTE this affects the HOST-targeted compiles of build scripts and proc macros too (they are
|
|
# x86_64-unknown-linux-gnu), which is exactly what we want: those link constantly and are pure
|
|
# overhead.
|
|
[target.x86_64-unknown-linux-gnu]
|
|
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|