build(rust): rebuild the archive for C test and CLI links

Make Rust sources normal prerequisites of native C test executables and CLI
builds. A changed Rust module now rebuilds libzstd_rs.a and relinks the target,
instead of relying on a manually prepared archive that can silently be stale.

The archive is linked after C objects, allowing migrated C shims to resolve
their Rust ABI symbols while remaining compatible with the existing makefile
flows. The migration guide now documents this behavior.

Test Plan:
- make -B -C tests fuzzer
- ./tests/fuzzer -i1 --no-big-tests
- make -B -C programs zstd
- ./programs/zstd --version

Refs: rust/README.md
This commit is contained in:
2026-07-10 20:11:42 +02:00
parent 57106c5c32
commit ebc43676b7
3 changed files with 44 additions and 10 deletions
+4 -3
View File
@@ -39,9 +39,10 @@ source file whose implementation has moved to Rust remains in the original
makefile source list as a small shim so header configuration and platform
preprocessor behavior stay available during the transition.
The original test makefile links `target/release/libzstd_rs.a` with whole-archive
semantics. Rebuild the Rust archive before running C tests so the executable
does not use a stale implementation.
The test and program makefiles make `target/release/libzstd_rs.a` a normal
link prerequisite. They rebuild the Rust archive and relink the executable
when a Rust source changes, so original C tests do not accidentally use a stale
implementation.
## Validation