On Thu, Sep 17, 2026 at 06:02:23PM +0400, Alexey Charkov wrote:

> SPL_ZSTD selects XXHASH, but xxhash.o is built from inside the
> ifndef CONFIG_XPL_BUILD block, so it never reaches an SPL link. zstd's
> decompressor calls xxh64_* from code that survives --gc-sections, so
> today the option only builds because nothing in SPL calls
> zstd_decompress() and the whole library is discarded. The first caller
> would fail to link.
> 
> Give xxhash its own phase symbol and build rule, the way the other
> compression libraries already have, and note in the SPL_ZSTD help how
> much heap the decompressor wants, since that is the other thing which
> may stop it from working.
> 
> Signed-off-by: Alexey Charkov <[email protected]>
> ---
>  lib/Kconfig  | 12 +++++++++++-
>  lib/Makefile |  3 ++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 6b6b90bc915c..6e6df5b3b191 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -833,6 +833,9 @@ config CRC32C
>  config XXHASH
>       bool
>  
> +config SPL_XXHASH
> +     bool
> +
>  endmenu
>  
>  menu "Compression Support"
> @@ -1011,10 +1014,17 @@ config TPL_ZLIB
>  config SPL_ZSTD
>       bool "Enable Zstandard decompression support in SPL"
>       depends on SPL
> -     select XXHASH
> +     select SPL_XXHASH
>       help
>         This enables Zstandard decompression library in the SPL.
>  
> +       Decompression allocates a 94KB context, and nothing else: the
> +       single-shot API it uses decompresses straight into the caller's
> +       buffer and takes its window from there, so the compression level
> +       does not change what the SPL heap has to hold.

This is good to explain here.

> With
> +       SPL_SYS_MALLOC_SIMPLE that memory is never returned, as free() does
> +       nothing there.

This is already noted in the help text for SPL_SYS_MALLOC_SIMPLE so we
shouldn't repeat ourselves.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to