Skip to content

build: keep wasm flags in .cargo config, fail on lost simd128 - #7

Merged
ilnmtlbnm merged 3 commits into
mainfrom
clean-build
Oct 12, 2026
Merged

ilnmtlbnm merged 3 commits into
mainfrom
clean-build

Conversation

@ilnmtlbnm

Copy link
Copy Markdown
Member

Build scripts keep the wasm32 flags in .cargo/config.toml and pass only the machine-dependent --remap-path-prefix flags inline through cargo --config, under the target.'cfg(all())'.rustflags key so they apply after any user-level remap. wasm-pack gets the extra args without a -- separator. A new scripts/check_wasm_features.py reads each wasm's target_features section and fails the build if +simd128 is missing (and +atomics for a threads build).

Verified locally before opening:

  • Same toolchain (1.99.0), clippy -D warnings as in CI (native, wasm32 web, wasm32 web+diag): clean.
  • Built with the old remap targets substituted, both wasm are byte-identical to main (lean default and threads). With the new targets only the remapped path strings change: default 3,540,511 -> 3,540,155 bytes, threads 4,931,937 -> 4,927,393; SIMD instruction counts unchanged (21,630 and 22,927); +atomics still present in the threads build.
  • Leak check reports no local paths in either wasm; the guard fails as expected on a wasm built without simd128.

.cargo/config.toml sets +simd128 for every wasm32 build and
.cargo/threads.toml holds the CPU-threads build's atomics and link
arguments, passed with cargo --config. Only the machine-dependent
--remap-path-prefix flags stay inline in build.sh, also via --config,
under the cfg(all()) key so they come after any user-level cfg(all())
remap and win. Cargo home is remapped too.
scripts/check_wasm_features.py reads each module's target_features
custom section. build.sh runs it on every wasm it produces, so CI and
local builds both catch a flag regression.
build-std compiles std from the nightly toolchain's source tree, whose
absolute path would otherwise end up in the CPU-threads wasm unless a
user-level remap happens to cover it.
@ilnmtlbnm
ilnmtlbnm merged commit 6daf322 into main Oct 12, 2026
2 checks passed
@ilnmtlbnm
ilnmtlbnm deleted the clean-build branch October 18, 2026 19:59
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