build(rust): link migrated code into native libraries
Build feature-matched Rust archives for the native Make library path. Flatten their members into libzstd.a so static consumers resolve C-to-Rust and Rust-to-C references in one archive, and whole-archive link shared outputs so every migrated public ABI export remains available. Rust compression and decompression features now mirror the C partial-library switches. This prevents compression-only artifacts from retaining DDict references to decompression-only C helpers. Add a C archive smoke test that round-trips data and exercises the DDict lifecycle through lib/libzstd.a, rather than direct test-object links. Test Plan: - cargo fmt, strict Clippy, cargo test --all-targets, release build - Rust checks with compression-only, decompression-only, and no features - full, partial, forced-HUF, and 32-bit static/shared Make library probes - test-rust-lib-smoke, fuzzer, zstreamtest, and invalidDictionaries Refs: rust/README.md
This commit is contained in:
+3
-1
@@ -7,7 +7,9 @@ edition = "2021"
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["compression", "decompression"]
|
||||
compression = []
|
||||
decompression = []
|
||||
huf-force-decompress-x1 = []
|
||||
huf-force-decompress-x2 = []
|
||||
|
||||
|
||||
+7
-3
@@ -46,9 +46,12 @@ 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 test and program makefiles select an archive directory for the active C
|
||||
configuration: default, forced HUF X1/X2, and the matching Rust target for
|
||||
32-bit C binaries. When the HUF mode changes, they also rebuild cached C
|
||||
The library, test, and program makefiles select an archive directory for the
|
||||
active C configuration: enabled compression/decompression modules, default or
|
||||
forced HUF X1/X2, and the matching Rust target for 32-bit C binaries. The
|
||||
native static archive flattens Rust object members rather than nesting a Rust
|
||||
archive, while the native shared library retains all migrated Rust exports.
|
||||
When the HUF mode changes, the test and program paths also rebuild cached C
|
||||
outputs before linking. This prevents original C tests from using a stale or
|
||||
configuration-incompatible implementation.
|
||||
|
||||
@@ -69,6 +72,7 @@ the narrow target for the component being migrated. For example:
|
||||
```sh
|
||||
make -C tests fuzzer
|
||||
./tests/fuzzer -i1 --no-big-tests
|
||||
make -C tests test-rust-lib-smoke
|
||||
```
|
||||
|
||||
Broader `tests/Makefile` targets remain the authoritative integration gates as
|
||||
|
||||
@@ -7,14 +7,19 @@ pub mod cpu;
|
||||
pub mod debug;
|
||||
pub mod entropy_common;
|
||||
pub mod errors;
|
||||
#[cfg(feature = "compression")]
|
||||
pub mod fse_compress;
|
||||
pub mod fse_decompress;
|
||||
#[cfg(feature = "compression")]
|
||||
pub mod hist;
|
||||
#[cfg(feature = "decompression")]
|
||||
pub mod huf_decompress;
|
||||
pub mod mem;
|
||||
pub mod pool;
|
||||
pub mod threading;
|
||||
pub mod xxhash;
|
||||
pub mod zstd_common;
|
||||
#[cfg(feature = "decompression")]
|
||||
pub mod zstd_ddict;
|
||||
#[cfg(feature = "compression")]
|
||||
pub mod zstd_presplit;
|
||||
|
||||
Reference in New Issue
Block a user