« All posts

Libxml-rs: A Forensic Native-Rust Reimplementation of libxml2/libxslt

Libxml-rs reimplements libxml2 and libxslt in native Rust with byte-exact ABI and behavioral parity as a C-ABI drop-in replacement.

Libxml-rs is a "custodial" project that reproduces the observable behavior of libxml2 and libxslt in native Rust with C ABI compatibility, positioning itself as a forensic archive rather than a conventional wrapper. It runs a 28-case behavioral corpus against 12 historical libxml2 releases (2.7.8-2.15.0) and 5 libxslt releases, tracing byte-exact differences back to specific upstream commits.

The project's historical matrix (Phase 11) ties findings — newline changes in xmllint output, shifting parser exit codes, and altered HTML dump behavior — to exact upstream commits, while also confirming that libxslt's core transform output has stayed byte-identical since 2009.

Phase 11.1 added ABI function-signature verification across thousands of exported symbols, uncovering dozens of real divergences: missing allocator hook fields, signedness mismatches, wrong argument counts, incorrect return types, and even a non-existent invented API. It also fixed undefined behavior in the default memory allocator.

Phase 12 demonstrates that generated ELF binaries and version scripts are indistinguishable from upstream to real downstream consumers — meaning engineers can treat it as a genuine drop-in native Rust replacement for the libxml2/libxslt C libraries.

This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work