git: 5ff13fbc199b - main - MFV: zstd 1.5.2

From: Allan Jude <allanjude_at_FreeBSD.org>
Date: Fri, 27 Jan 2023 17:31:31 UTC
The branch main has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=5ff13fbc199bdf5f0572845351c68ee5ca828e71

commit 5ff13fbc199bdf5f0572845351c68ee5ca828e71
Merge: 68636dcb6fde b3392d84da5b
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2023-01-27 17:22:31 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2023-01-27 17:22:31 +0000

    MFV: zstd 1.5.2
    
    Merge commit 'b3392d84da5bf2162baf937c77e0557f3fd8a52b' into zstd_1.5.2
    
    full changelog: https://github.com/facebook/zstd/compare/v1.4.8...v1.5.2
    
    Updated sys/kern/subr_compressor.c to new API
    
    MFC after:      3 days
    Relnotes:       yes
    Sponsored by:   Klara, Inc.

 sys/contrib/zstd/CHANGELOG                         |  105 +
 sys/contrib/zstd/CONTRIBUTING.md                   |  211 +-
 sys/contrib/zstd/Makefile                          |   87 +-
 sys/contrib/zstd/README.md                         |   40 +-
 sys/contrib/zstd/TESTING.md                        |    1 -
 sys/contrib/zstd/appveyor.yml                      |  171 +-
 sys/contrib/zstd/doc/educational_decoder/Makefile  |    2 +-
 sys/contrib/zstd/doc/educational_decoder/harness.c |    2 +-
 .../zstd/doc/educational_decoder/zstd_decompress.c |    4 +-
 .../zstd/doc/educational_decoder/zstd_decompress.h |    2 +-
 sys/contrib/zstd/doc/zstd_compression_format.md    |    6 +-
 sys/contrib/zstd/doc/zstd_manual.html              |  336 +-
 sys/contrib/zstd/examples/Makefile                 |    2 +-
 sys/contrib/zstd/examples/common.h                 |    4 +-
 sys/contrib/zstd/examples/dictionary_compression.c |    2 +-
 .../zstd/examples/dictionary_decompression.c       |    2 +-
 .../zstd/examples/multiple_simple_compression.c    |    2 +-
 .../zstd/examples/multiple_streaming_compression.c |    2 +-
 sys/contrib/zstd/examples/simple_compression.c     |    2 +-
 sys/contrib/zstd/examples/simple_decompression.c   |    2 +-
 sys/contrib/zstd/examples/streaming_compression.c  |   32 +-
 .../examples/streaming_compression_thread_pool.c   |   10 +-
 .../zstd/examples/streaming_decompression.c        |    2 +-
 sys/contrib/zstd/examples/streaming_memory_usage.c |    2 +-
 sys/contrib/zstd/lib/BUCK                          |   12 +-
 sys/contrib/zstd/lib/Makefile                      |  266 +-
 sys/contrib/zstd/lib/README.md                     |   20 +-
 sys/contrib/zstd/lib/common/bitstream.h            |   35 +-
 sys/contrib/zstd/lib/common/compiler.h             |  135 +-
 sys/contrib/zstd/lib/common/cpu.h                  |    2 +-
 sys/contrib/zstd/lib/common/debug.c                |    2 +-
 sys/contrib/zstd/lib/common/debug.h                |    2 +-
 sys/contrib/zstd/lib/common/entropy_common.c       |   18 +-
 sys/contrib/zstd/lib/common/error_private.c        |    2 +-
 sys/contrib/zstd/lib/common/error_private.h        |   85 +-
 sys/contrib/zstd/lib/common/fse.h                  |    7 +-
 sys/contrib/zstd/lib/common/fse_decompress.c       |   42 +-
 sys/contrib/zstd/lib/common/huf.h                  |   51 +-
 sys/contrib/zstd/lib/common/mem.h                  |   26 +-
 sys/contrib/zstd/lib/common/pool.c                 |   19 +-
 sys/contrib/zstd/lib/common/pool.h                 |    6 +-
 sys/contrib/zstd/lib/common/portability_macros.h   |  137 +
 sys/contrib/zstd/lib/common/xxhash.c               |  814 +--
 sys/contrib/zstd/lib/common/xxhash.h               | 5739 +++++++++++++++++++-
 sys/contrib/zstd/lib/common/zstd_common.c          |    2 +-
 sys/contrib/zstd/lib/common/zstd_deps.h            |    2 +-
 sys/contrib/zstd/lib/common/zstd_internal.h        |  215 +-
 sys/contrib/zstd/lib/common/zstd_trace.h           |  163 +
 sys/contrib/zstd/lib/compress/clevels.h            |  134 +
 sys/contrib/zstd/lib/compress/fse_compress.c       |   92 +-
 sys/contrib/zstd/lib/compress/hist.c               |    2 +-
 sys/contrib/zstd/lib/compress/hist.h               |    2 +-
 sys/contrib/zstd/lib/compress/huf_compress.c       |  712 ++-
 sys/contrib/zstd/lib/compress/zstd_compress.c      | 2249 ++++++--
 .../zstd/lib/compress/zstd_compress_internal.h     |  443 +-
 .../zstd/lib/compress/zstd_compress_literals.c     |   15 +-
 .../zstd/lib/compress/zstd_compress_literals.h     |    6 +-
 .../zstd/lib/compress/zstd_compress_sequences.c    |   43 +-
 .../zstd/lib/compress/zstd_compress_sequences.h    |    2 +-
 .../zstd/lib/compress/zstd_compress_superblock.c   |  296 +-
 .../zstd/lib/compress/zstd_compress_superblock.h   |    2 +-
 sys/contrib/zstd/lib/compress/zstd_cwksp.h         |  241 +-
 sys/contrib/zstd/lib/compress/zstd_double_fast.c   |  417 +-
 sys/contrib/zstd/lib/compress/zstd_double_fast.h   |    2 +-
 sys/contrib/zstd/lib/compress/zstd_fast.c          |  445 +-
 sys/contrib/zstd/lib/compress/zstd_fast.h          |    2 +-
 sys/contrib/zstd/lib/compress/zstd_lazy.c          | 1352 +++--
 sys/contrib/zstd/lib/compress/zstd_lazy.h          |   40 +-
 sys/contrib/zstd/lib/compress/zstd_ldm.c           |  474 +-
 sys/contrib/zstd/lib/compress/zstd_ldm.h           |    5 +-
 sys/contrib/zstd/lib/compress/zstd_ldm_geartab.h   |  106 +
 sys/contrib/zstd/lib/compress/zstd_opt.c           |  399 +-
 sys/contrib/zstd/lib/compress/zstd_opt.h           |    2 +-
 sys/contrib/zstd/lib/compress/zstdmt_compress.c    |  146 +-
 sys/contrib/zstd/lib/compress/zstdmt_compress.h    |   15 +-
 sys/contrib/zstd/lib/decompress/huf_decompress.c   |  961 +++-
 .../zstd/lib/decompress/huf_decompress_amd64.S     |  585 ++
 sys/contrib/zstd/lib/decompress/zstd_ddict.c       |    2 +-
 sys/contrib/zstd/lib/decompress/zstd_ddict.h       |    2 +-
 sys/contrib/zstd/lib/decompress/zstd_decompress.c  |  354 +-
 .../zstd/lib/decompress/zstd_decompress_block.c    | 1038 +++-
 .../zstd/lib/decompress/zstd_decompress_block.h    |   12 +-
 .../zstd/lib/decompress/zstd_decompress_internal.h |   56 +-
 sys/contrib/zstd/lib/deprecated/zbuff.h            |    2 +-
 sys/contrib/zstd/lib/deprecated/zbuff_common.c     |    2 +-
 sys/contrib/zstd/lib/deprecated/zbuff_compress.c   |   28 +-
 sys/contrib/zstd/lib/deprecated/zbuff_decompress.c |    2 +-
 sys/contrib/zstd/lib/dictBuilder/cover.c           |   44 +-
 sys/contrib/zstd/lib/dictBuilder/cover.h           |   11 +-
 sys/contrib/zstd/lib/dictBuilder/divsufsort.c      |    2 +-
 sys/contrib/zstd/lib/dictBuilder/fastcover.c       |   38 +-
 sys/contrib/zstd/lib/dictBuilder/zdict.c           |  165 +-
 sys/contrib/zstd/lib/legacy/zstd_legacy.h          |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v01.c             |   10 +-
 sys/contrib/zstd/lib/legacy/zstd_v01.h             |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v02.c             |   12 +-
 sys/contrib/zstd/lib/legacy/zstd_v02.h             |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v03.c             |   12 +-
 sys/contrib/zstd/lib/legacy/zstd_v03.h             |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v04.c             |   12 +-
 sys/contrib/zstd/lib/legacy/zstd_v04.h             |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v05.c             |   20 +-
 sys/contrib/zstd/lib/legacy/zstd_v05.h             |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v06.c             |   20 +-
 sys/contrib/zstd/lib/legacy/zstd_v06.h             |    2 +-
 sys/contrib/zstd/lib/legacy/zstd_v07.c             |   20 +-
 sys/contrib/zstd/lib/legacy/zstd_v07.h             |    2 +-
 sys/contrib/zstd/lib/libzstd.mk                    |  203 +
 sys/contrib/zstd/lib/libzstd.pc.in                 |    1 +
 sys/contrib/zstd/lib/module.modulemap              |   25 +
 sys/contrib/zstd/lib/{dictBuilder => }/zdict.h     |  159 +-
 sys/contrib/zstd/lib/zstd.h                        |  576 +-
 sys/contrib/zstd/lib/{common => }/zstd_errors.h    |    2 +-
 sys/contrib/zstd/programs/Makefile                 |  180 +-
 sys/contrib/zstd/programs/README.md                |    6 +-
 sys/contrib/zstd/programs/benchfn.c                |    2 +-
 sys/contrib/zstd/programs/benchfn.h                |    2 +-
 sys/contrib/zstd/programs/benchzstd.c              |   64 +-
 sys/contrib/zstd/programs/benchzstd.h              |    5 +-
 sys/contrib/zstd/programs/datagen.c                |    2 +-
 sys/contrib/zstd/programs/datagen.h                |    2 +-
 sys/contrib/zstd/programs/dibio.c                  |  253 +-
 sys/contrib/zstd/programs/dibio.h                  |   10 +-
 sys/contrib/zstd/programs/fileio.c                 |  440 +-
 sys/contrib/zstd/programs/fileio.h                 |   11 +-
 sys/contrib/zstd/programs/platform.h               |    3 +-
 sys/contrib/zstd/programs/timefn.c                 |    2 +-
 sys/contrib/zstd/programs/timefn.h                 |    2 +-
 sys/contrib/zstd/programs/util.c                   |  284 +-
 sys/contrib/zstd/programs/util.h                   |   39 +-
 sys/contrib/zstd/programs/zstd.1                   |   36 +-
 sys/contrib/zstd/programs/zstd.1.md                |   62 +-
 sys/contrib/zstd/programs/zstdcli.c                |  203 +-
 sys/contrib/zstd/programs/zstdcli_trace.c          |  172 +
 sys/contrib/zstd/programs/zstdcli_trace.h          |   24 +
 sys/contrib/zstd/programs/zstdgrep.1               |    7 +-
 sys/contrib/zstd/programs/zstdgrep.1.md            |    6 +-
 sys/contrib/zstd/programs/zstdless.1               |    2 +-
 sys/contrib/zstd/zlibWrapper/Makefile              |   44 +-
 sys/contrib/zstd/zlibWrapper/examples/fitblk.c     |    2 +-
 .../zstd/zlibWrapper/examples/fitblk_original.c    |    2 +-
 sys/contrib/zstd/zlibWrapper/examples/zwrapbench.c |   27 +-
 sys/contrib/zstd/zlibWrapper/gzcompatibility.h     |    2 +-
 sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c    |   40 +-
 sys/contrib/zstd/zlibWrapper/zstd_zlibwrapper.h    |    2 +-
 sys/kern/subr_compressor.c                         |    7 +-
 usr.bin/zstd/Makefile                              |    3 +-
 147 files changed, 17337 insertions(+), 5480 deletions(-)

diff --cc sys/contrib/zstd/Makefile
index 2832fb4752b8,000000000000..9b5451d3d748
mode 100644,000000..100644
--- a/sys/contrib/zstd/Makefile
+++ b/sys/contrib/zstd/Makefile
@@@ -1,420 -1,0 +1,439 @@@
 +# ################################################################
- # Copyright (c) 2015-2020, Yann Collet, Facebook, Inc.
++# Copyright (c) 2015-2021, Yann Collet, Facebook, Inc.
 +# All rights reserved.
 +#
 +# This source code is licensed under both the BSD-style license (found in the
 +# LICENSE file in the root directory of this source tree) and the GPLv2 (found
 +# in the COPYING file in the root directory of this source tree).
 +# You may select, at your option, one of the above-listed licenses.
 +# ################################################################
 +
 +# verbose mode (print commands) on V=1 or VERBOSE=1
 +Q = $(if $(filter 1,$(V) $(VERBOSE)),,@)
 +
 +PRGDIR   = programs
 +ZSTDDIR  = lib
 +BUILDIR  = build
 +ZWRAPDIR = zlibWrapper
 +TESTDIR  = tests
 +FUZZDIR  = $(TESTDIR)/fuzz
 +
 +# Define nul output
 +VOID = /dev/null
 +
 +# When cross-compiling from linux to windows, you might
 +# need to specify this as "Windows." Fedora build fails
 +# without it.
 +#
 +# Note: mingw-w64 build from linux to windows does not
 +# fail on other tested distros (ubuntu, debian) even
 +# without manually specifying the TARGET_SYSTEM.
 +TARGET_SYSTEM ?= $(OS)
++CP ?= cp
 +
 +ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
 +  EXT =.exe
 +else
 +  EXT =
 +endif
 +
 +## default: Build lib-release and zstd-release
 +.PHONY: default
 +default: lib-release zstd-release
 +
 +.PHONY: all
 +all: allmost examples manual contrib
 +
 +.PHONY: allmost
 +allmost: allzstd zlibwrapper
 +
 +# skip zwrapper, can't build that on alternate architectures without the proper zlib installed
 +.PHONY: allzstd
- allzstd: lib-all
++allzstd: lib
 +	$(Q)$(MAKE) -C $(PRGDIR) all
 +	$(Q)$(MAKE) -C $(TESTDIR) all
 +
 +.PHONY: all32
 +all32:
 +	$(MAKE) -C $(PRGDIR) zstd32
 +	$(MAKE) -C $(TESTDIR) all32
 +
- .PHONY: lib lib-release libzstd.a
- lib-all : lib
- lib lib-release lib-all :
++.PHONY: lib lib-release lib-mt lib-nomt
++lib lib-release lib-mt lib-nomt:
 +	$(Q)$(MAKE) -C $(ZSTDDIR) $@
 +
 +.PHONY: zstd zstd-release
 +zstd zstd-release:
 +	$(Q)$(MAKE) -C $(PRGDIR) $@
 +	$(Q)ln -sf $(PRGDIR)/zstd$(EXT) zstd$(EXT)
 +
 +.PHONY: zstdmt
 +zstdmt:
 +	$(Q)$(MAKE) -C $(PRGDIR) $@
- 	$(Q)cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
++	$(Q)$(CP) $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
 +
 +.PHONY: zlibwrapper
 +zlibwrapper: lib
 +	$(MAKE) -C $(ZWRAPDIR) all
 +
 +## test: run long-duration tests
 +.PHONY: test
 +DEBUGLEVEL ?= 1
 +test: MOREFLAGS += -g -Werror
 +test:
 +	DEBUGLEVEL=$(DEBUGLEVEL) MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
 +	$(MAKE) -C $(TESTDIR) $@
 +	ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder $@
 +
 +## shortest: same as `make check`
 +.PHONY: shortest
 +shortest:
 +	$(Q)$(MAKE) -C $(TESTDIR) $@
 +
 +## check: run basic tests for `zstd` cli
 +.PHONY: check
 +check: shortest
 +
 +.PHONY: automated_benchmarking
 +automated_benchmarking:
 +	$(MAKE) -C $(TESTDIR) $@
 +
 +.PHONY: benchmarking
 +benchmarking: automated_benchmarking
 +
 +## examples: build all examples in `examples/` directory
 +.PHONY: examples
 +examples: lib
 +	$(MAKE) -C examples all
 +
 +## manual: generate API documentation in html format
 +.PHONY: manual
 +manual:
 +	$(MAKE) -C contrib/gen_html $@
 +
 +## man: generate man page
 +.PHONY: man
 +man:
 +	$(MAKE) -C programs $@
 +
 +## contrib: build all supported projects in `/contrib` directory
 +.PHONY: contrib
 +contrib: lib
 +	$(MAKE) -C contrib/pzstd all
 +	$(MAKE) -C contrib/seekable_format/examples all
 +	$(MAKE) -C contrib/seekable_format/tests test
 +	$(MAKE) -C contrib/largeNbDicts all
- 	cd contrib/single_file_libs/ ; ./build_decoder_test.sh
- 	cd contrib/single_file_libs/ ; ./build_library_test.sh
++	cd build/single_file_libs/ ; ./build_decoder_test.sh
++	cd build/single_file_libs/ ; ./build_library_test.sh
 +
 +.PHONY: cleanTabs
 +cleanTabs:
 +	cd contrib; ./cleanTabs
 +
 +.PHONY: clean
 +clean:
 +	$(Q)$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
 +	$(Q)$(MAKE) -C $(PRGDIR) $@ > $(VOID)
 +	$(Q)$(MAKE) -C $(TESTDIR) $@ > $(VOID)
 +	$(Q)$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
 +	$(Q)$(MAKE) -C examples/ $@ > $(VOID)
 +	$(Q)$(MAKE) -C contrib/gen_html $@ > $(VOID)
 +	$(Q)$(MAKE) -C contrib/pzstd $@ > $(VOID)
 +	$(Q)$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
 +	$(Q)$(MAKE) -C contrib/seekable_format/tests $@ > $(VOID)
 +	$(Q)$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
 +	$(Q)$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
 +	$(Q)$(RM) -r lz4
 +	@echo Cleaning completed
 +
 +#------------------------------------------------------------------------------
 +# make install is validated only for Linux, macOS, Hurd and some BSD targets
 +#------------------------------------------------------------------------------
- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku))
++ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku AIX))
 +
 +HOST_OS = POSIX
- CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
++
++MKDIR ?= mkdir -p
 +
 +HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
 +EGREP_OPTIONS ?=
 +ifeq ($HAVE_COLORNEVER, 1)
 +EGREP_OPTIONS += --color=never
 +endif
 +EGREP = egrep $(EGREP_OPTIONS)
 +
 +# Print a two column output of targets and their description. To add a target description, put a
 +# comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>".  For example:
 +#
 +## list: Print all targets and their descriptions (if provided)
 +.PHONY: list
 +list:
 +	$(Q)TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
 +		| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
 +		| $(EGREP) -v  -e '^[^[:alnum:]]' | sort); \
 +	{ \
 +	    printf "Target Name\tDescription\n"; \
 +	    printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
 +	    for target in $$TARGETS; do \
 +	        line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
 +	        description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
 +	        printf "$$target\t$$description\n"; \
 +	    done \
 +	} | column -t -s $$'\t'
 +
- .PHONY: install armtest usan asan uasan
++.PHONY: install armtest usan asan uasan msan asan32
 +install:
 +	$(Q)$(MAKE) -C $(ZSTDDIR) $@
 +	$(Q)$(MAKE) -C $(PRGDIR) $@
 +
 +.PHONY: uninstall
 +uninstall:
 +	$(Q)$(MAKE) -C $(ZSTDDIR) $@
 +	$(Q)$(MAKE) -C $(PRGDIR) $@
 +
 +.PHONY: travis-install
 +travis-install:
 +	$(MAKE) install PREFIX=~/install_test_dir
 +
- .PHONY: gcc5build
++.PHONY: gcc5build gcc6build gcc7build clangbuild m32build armbuild aarch64build ppcbuild ppc64build
 +gcc5build: clean
 +	gcc-5 -v
 +	CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
 +
- .PHONY: gcc6build
 +gcc6build: clean
 +	gcc-6 -v
 +	CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
 +
- .PHONY: gcc7build
 +gcc7build: clean
 +	gcc-7 -v
 +	CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
 +
- .PHONY: clangbuild
 +clangbuild: clean
 +	clang -v
 +	CXX=clang++ CC=clang CFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" $(MAKE) all
 +
 +m32build: clean
 +	gcc -v
 +	$(MAKE) all32
 +
 +armbuild: clean
 +	CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
 +
 +aarch64build: clean
- 	CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
++	CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd
 +
 +ppcbuild: clean
- 	CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd
++	CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) -j allzstd
 +
 +ppc64build: clean
- 	CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd
++	CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) -j allzstd
 +
++.PHONY: armfuzz aarch64fuzz ppcfuzz ppc64fuzz
 +armfuzz: clean
 +	CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
 +
 +aarch64fuzz: clean
 +	ld -v
 +	CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
 +
 +ppcfuzz: clean
 +	CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
 +
 +ppc64fuzz: clean
 +	CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
 +
- .PHONY: cxxtest
++.PHONY: cxxtest gcc5test gcc6test armtest aarch64test ppctest ppc64test
 +cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
 +cxxtest: clean
 +	$(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)"   # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly
 +
 +gcc5test: clean
 +	gcc-5 -v
 +	$(MAKE) all CC=gcc-5 MOREFLAGS="-Werror"
 +
 +gcc6test: clean
 +	gcc-6 -v
 +	$(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
 +
 +armtest: clean
 +	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
 +	$(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
 +
 +aarch64test:
 +	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
 +	$(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
 +
 +ppctest: clean
 +	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
 +	$(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" FUZZER_FLAGS=--no-big-tests
 +
 +ppc64test: clean
 +	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
 +	$(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests
 +
++.PHONY: arm-ppc-compilation
 +arm-ppc-compilation:
 +	$(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
 +	$(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
 +	$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static"
 +	$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static"
 +
 +regressiontest:
 +	$(MAKE) -C $(FUZZDIR) regressiontest
 +
 +uasanregressiontest:
 +	$(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined"
 +
 +msanregressiontest:
 +	$(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
 +
- # run UBsan with -fsanitize-recover=signed-integer-overflow
- # due to a bug in UBsan when doing pointer subtraction
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
- 
++update_regressionResults : REGRESS_RESULTS_DIR := /tmp/regress_results_dir/
++update_regressionResults:
++	$(MAKE) -C programs zstd
++	$(MAKE) -C tests/regression test
++	$(RM) -rf $(REGRESS_RESULTS_DIR)
++	$(MKDIR) $(REGRESS_RESULTS_DIR)
++	./tests/regression/test                         \
++        --cache  tests/regression/cache             \
++        --output $(REGRESS_RESULTS_DIR)/results.csv \
++        --zstd   programs/zstd
++	echo "Showing results differences"
++	! diff tests/regression/results.csv $(REGRESS_RESULTS_DIR)/results.csv
++	echo "Updating results.csv"
++	$(CP) $(REGRESS_RESULTS_DIR)/results.csv tests/regression/results.csv
++
++
++# run UBsan with -fsanitize-recover=pointer-overflow
++# this only works with recent compilers such as gcc 8+
 +usan: clean
- 	$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined -Werror"
++	$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=undefined -Werror"
 +
 +asan: clean
 +	$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror"
 +
 +asan-%: clean
 +	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror" $(MAKE) -C $(TESTDIR) $*
 +
 +msan: clean
 +	$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer -Werror" HAVE_LZMA=0   # datagen.c fails this test for no obvious reason
 +
 +msan-%: clean
 +	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer -Werror" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $*
 +
 +asan32: clean
 +	$(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
 +
 +uasan: clean
- 	$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror"
++	$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=address,undefined -Werror"
 +
 +uasan-%: clean
- 	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $*
++	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $*
 +
 +tsan-%: clean
 +	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
 +
++.PHONY: apt-install
 +apt-install:
 +	sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
 +
++.PHONY: apt-add-repo
 +apt-add-repo:
 +	sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
 +	sudo apt-get update -y -qq
 +
++.PHONY: ppcinstall arminstall valgrindinstall libc6install gcc6install gcc7install gcc8install gpp6install clang38install lz4install
 +ppcinstall:
 +	APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
 +
 +arminstall:
 +	APT_PACKAGES="qemu-system-arm qemu-user-static gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross" $(MAKE) apt-install
 +
 +valgrindinstall:
 +	APT_PACKAGES="valgrind" $(MAKE) apt-install
 +
 +libc6install:
 +	APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install
 +
 +gcc6install: apt-add-repo
 +	APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install
 +
 +gcc7install: apt-add-repo
 +	APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib" $(MAKE) apt-install
 +
 +gcc8install: apt-add-repo
 +	APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-8 gcc-8-multilib" $(MAKE) apt-install
 +
 +gpp6install: apt-add-repo
 +	APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install
 +
 +clang38install:
 +	APT_PACKAGES="clang-3.8" $(MAKE) apt-install
 +
 +# Ubuntu 14.04 ships a too-old lz4
 +lz4install:
 +	[ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
 +
 +endif
 +
 +
++CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
++
 +ifneq (,$(filter MSYS%,$(shell uname)))
 +HOST_OS = MSYS
 +CMAKE_PARAMS = -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
 +endif
 +
- 
 +#------------------------------------------------------------------------
 +# target specific tests
 +#------------------------------------------------------------------------
 +ifneq (,$(filter $(HOST_OS),MSYS POSIX))
++.PHONY: cmakebuild c89build gnu90build c99build gnu99build c11build bmix64build bmix32build bmi32build staticAnalyze
 +cmakebuild:
 +	cmake --version
 +	$(RM) -r $(BUILDIR)/cmake/build
- 	mkdir $(BUILDIR)/cmake/build
++	$(MKDIR) $(BUILDIR)/cmake/build
 +	cd $(BUILDIR)/cmake/build; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) ..
 +	$(MAKE) -C $(BUILDIR)/cmake/build -j4;
 +	$(MAKE) -C $(BUILDIR)/cmake/build install;
 +	$(MAKE) -C $(BUILDIR)/cmake/build uninstall;
 +	cd $(BUILDIR)/cmake/build; ctest -V -L Medium
 +
 +c89build: clean
 +	$(CC) -v
- 	CFLAGS="-std=c89 -Werror" $(MAKE) allmost  # will fail, due to missing support for `long long`
++	CFLAGS="-std=c89 -Werror -O0" $(MAKE) allmost  # will fail, due to missing support for `long long`
 +
 +gnu90build: clean
 +	$(CC) -v
- 	CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
++	CFLAGS="-std=gnu90 -Werror -O0" $(MAKE) allmost
 +
 +c99build: clean
 +	$(CC) -v
- 	CFLAGS="-std=c99 -Werror" $(MAKE) allmost
++	CFLAGS="-std=c99 -Werror -O0" $(MAKE) allmost
 +
 +gnu99build: clean
 +	$(CC) -v
- 	CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
++	CFLAGS="-std=gnu99 -Werror -O0" $(MAKE) allmost
 +
 +c11build: clean
 +	$(CC) -v
- 	CFLAGS="-std=c11 -Werror" $(MAKE) allmost
++	CFLAGS="-std=c11 -Werror -O0" $(MAKE) allmost
 +
 +bmix64build: clean
 +	$(CC) -v
 +	CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test
 +
 +bmix32build: clean
 +	$(CC) -v
 +	CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test
 +
 +bmi32build: clean
 +	$(CC) -v
 +	CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
 +
 +# static analyzer test uses clang's scan-build
 +# does not analyze zlibWrapper, due to detected issues in zlib source code
 +staticAnalyze: SCANBUILD ?= scan-build
 +staticAnalyze:
 +	$(CC) -v
- 	CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib
++	CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) zstd
 +endif
diff --cc sys/contrib/zstd/README.md
index dcca7662d2ff,000000000000..69720ba2ccf8
mode 100644,000000..100644
--- a/sys/contrib/zstd/README.md
+++ b/sys/contrib/zstd/README.md
@@@ -1,199 -1,0 +1,199 @@@
 +<p align="center"><img src="https://raw.githubusercontent.com/facebook/zstd/dev/doc/images/zstd_logo86.png" alt="Zstandard"></p>
 +
 +__Zstandard__, or `zstd` as short version, is a fast lossless compression algorithm,
 +targeting real-time compression scenarios at zlib-level and better compression ratios.
 +It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy).
 +
- The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library,
++Zstandard's format is stable and documented in [RFC8878](https://datatracker.ietf.org/doc/html/rfc8878). Multiple independent implementations are already available.
++This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library,
 +and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files.
 +Should your project require another programming language,
 +a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages).
 +
 +**Development branch status:**
 +
 +[![Build Status][travisDevBadge]][travisLink]
 +[![Build status][AppveyorDevBadge]][AppveyorLink]
 +[![Build status][CircleDevBadge]][CircleLink]
 +[![Build status][CirrusDevBadge]][CirrusLink]
 +[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink]
 +
- [travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
- [travisLink]: https://travis-ci.org/facebook/zstd
++[travisDevBadge]: https://api.travis-ci.com/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
++[travisLink]: https://travis-ci.com/facebook/zstd
 +[AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite"
 +[AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0
 +[CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite"
 +[CircleLink]: https://circleci.com/gh/facebook/zstd
 +[CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev
 +[CirrusLink]: https://cirrus-ci.com/github/facebook/zstd
 +[OSSFuzzBadge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/zstd.svg
 +[OSSFuzzLink]: https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zstd
 +
 +## Benchmarks
 +
 +For reference, several fast compression algorithms were tested and compared
- on a server running Arch Linux (`Linux version 5.5.11-arch1-1`),
- with a Core i9-9900K CPU @ 5.0GHz,
++on a desktop running Ubuntu 20.04 (`Linux 5.11.0-41-generic`),
++with a Core i7-9700K CPU @ 4.9GHz,
 +using [lzbench], an open-source in-memory benchmark by @inikep
 +compiled with [gcc] 9.3.0,
 +on the [Silesia compression corpus].
 +
 +[lzbench]: https://github.com/inikep/lzbench
 +[Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
 +[gcc]: https://gcc.gnu.org/
 +
 +| Compressor name         | Ratio | Compression| Decompress.|
 +| ---------------         | ------| -----------| ---------- |
- | **zstd 1.4.5 -1**       | 2.884 |   500 MB/s |  1660 MB/s |
- | zlib 1.2.11 -1          | 2.743 |    90 MB/s |   400 MB/s |
- | brotli 1.0.7 -0         | 2.703 |   400 MB/s |   450 MB/s |
- | **zstd 1.4.5 --fast=1** | 2.434 |   570 MB/s |  2200 MB/s |
- | **zstd 1.4.5 --fast=3** | 2.312 |   640 MB/s |  2300 MB/s |
- | quicklz 1.5.0 -1        | 2.238 |   560 MB/s |   710 MB/s |
- | **zstd 1.4.5 --fast=5** | 2.178 |   700 MB/s |  2420 MB/s |
- | lzo1x 2.10 -1           | 2.106 |   690 MB/s |   820 MB/s |
- | lz4 1.9.2               | 2.101 |   740 MB/s |  4530 MB/s |
- | **zstd 1.4.5 --fast=7** | 2.096 |   750 MB/s |  2480 MB/s |
- | lzf 3.6 -1              | 2.077 |   410 MB/s |   860 MB/s |
- | snappy 1.1.8            | 2.073 |   560 MB/s |  1790 MB/s |
++| **zstd 1.5.1 -1**       | 2.887 |   530 MB/s |  1700 MB/s |
++| [zlib] 1.2.11 -1        | 2.743 |    95 MB/s |   400 MB/s |
++| brotli 1.0.9 -0         | 2.702 |   395 MB/s |   450 MB/s |
++| **zstd 1.5.1 --fast=1** | 2.437 |   600 MB/s |  2150 MB/s |
++| **zstd 1.5.1 --fast=3** | 2.239 |   670 MB/s |  2250 MB/s |
++| quicklz 1.5.0 -1        | 2.238 |   540 MB/s |   760 MB/s |
++| **zstd 1.5.1 --fast=4** | 2.148 |   710 MB/s |  2300 MB/s |
++| lzo1x 2.10 -1           | 2.106 |   660 MB/s |   845 MB/s |
++| [lz4] 1.9.3             | 2.101 |   740 MB/s |  4500 MB/s |
++| lzf 3.6 -1              | 2.077 |   410 MB/s |   830 MB/s |
++| snappy 1.1.9            | 2.073 |   550 MB/s |  1750 MB/s |
 +
 +[zlib]: http://www.zlib.net/
- [LZ4]: http://www.lz4.org/
++[lz4]: http://www.lz4.org/
 +
 +The negative compression levels, specified with `--fast=#`,
- offer faster compression and decompression speed in exchange for some loss in
- compression ratio compared to level 1, as seen in the table above.
++offer faster compression and decompression speed
++at the cost of compression ratio (compared to level 1).
 +
 +Zstd can also offer stronger compression ratios at the cost of compression speed.
 +Speed vs Compression trade-off is configurable by small increments.
 +Decompression speed is preserved and remains roughly the same at all settings,
 +a property shared by most LZ compression algorithms, such as [zlib] or lzma.
 +
 +The following tests were run
 +on a server running Linux Debian (`Linux version 4.14.0-3-amd64`)
 +with a Core i7-6700K CPU @ 4.0GHz,
 +using [lzbench], an open-source in-memory benchmark by @inikep
 +compiled with [gcc] 7.3.0,
 +on the [Silesia compression corpus].
 +
 +Compression Speed vs Ratio | Decompression Speed
 +---------------------------|--------------------
 +![Compression Speed vs Ratio](doc/images/CSpeed2.png "Compression Speed vs Ratio") | ![Decompression Speed](doc/images/DSpeed3.png "Decompression Speed")
 +
 +A few other algorithms can produce higher compression ratios at slower speeds, falling outside of the graph.
 +For a larger picture including slow modes, [click on this link](doc/images/DCspeed5.png).
 +
 +
 +## The case for Small Data compression
 +
 +Previous charts provide results applicable to typical file and stream scenarios (several MB). Small data comes with different perspectives.
 +
 +The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no "past" to build upon.
 +
 +To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data.
 +Training Zstandard is achieved by providing it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression.
 +Using this dictionary, the compression ratio achievable on small data improves dramatically.
 +
 +The following example uses the `github-users` [sample set](https://github.com/facebook/zstd/releases/tag/v1.1.3), created from [github public API](https://developer.github.com/v3/users/#get-all-users).
 +It consists of roughly 10K records weighing about 1KB each.
 +
 +Compression Ratio | Compression Speed | Decompression Speed
 +------------------|-------------------|--------------------
 +![Compression Ratio](doc/images/dict-cr.png "Compression Ratio") | ![Compression Speed](doc/images/dict-cs.png "Compression Speed") | ![Decompression Speed](doc/images/dict-ds.png "Decompression Speed")
 +
 +
 +These compression gains are achieved while simultaneously providing _faster_ compression and decompression speeds.
 +
 +Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no _universal dictionary_).
 +Hence, deploying one dictionary per type of data will provide the greatest benefits.
 +Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file.
 +
 +### Dictionary compression How To:
 +
 +1. Create the dictionary
 +
 +   `zstd --train FullPathToTrainingSet/* -o dictionaryName`
 +
 +2. Compress with dictionary
 +
 +   `zstd -D dictionaryName FILE`
 +
 +3. Decompress with dictionary
 +
 +   `zstd -D dictionaryName --decompress FILE.zst`
 +
 +
 +## Build instructions
 +
 +### Makefile
 +
 +If your system is compatible with standard `make` (or `gmake`),
 +invoking `make` in root directory will generate `zstd` cli in root directory.
 +
 +Other available options include:
 +- `make install` : create and install zstd cli, library and man pages
 +- `make check` : create and run `zstd`, tests its behavior on local platform
 +
 +### cmake
 +
 +A `cmake` project generator is provided within `build/cmake`.
 +It can generate Makefiles or other build scripts
 +to create `zstd` binary, and `libzstd` dynamic and static libraries.
 +
 +By default, `CMAKE_BUILD_TYPE` is set to `Release`.
 +
 +### Meson
 +
 +A Meson project is provided within [`build/meson`](build/meson). Follow
 +build instructions in that directory.
 +
 +You can also take a look at [`.travis.yml`](.travis.yml) file for an
 +example about how Meson is used to build this project.
 +
 +Note that default build type is **release**.
 +
 +### VCPKG
 +You can build and install zstd [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
 +
 +    git clone https://github.com/Microsoft/vcpkg.git
 +    cd vcpkg
 +    ./bootstrap-vcpkg.sh
 +    ./vcpkg integrate install
 +    ./vcpkg install zstd
 +
 +The zstd port in vcpkg is kept up to date by Microsoft team members and community contributors.
 +If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
 +
 +### Visual Studio (Windows)
 +
 +Going into `build` directory, you will find additional possibilities:
 +- Projects for Visual Studio 2005, 2008 and 2010.
 +  + VS2010 project is compatible with VS2012, VS2013, VS2015 and VS2017.
 +- Automated build scripts for Visual compiler by [@KrzysFR](https://github.com/KrzysFR), in `build/VS_scripts`,
 +  which will build `zstd` cli and `libzstd` library without any need to open Visual Studio solution.
 +
 +### Buck
 +
 +You can build the zstd binary via buck by executing: `buck build programs:zstd` from the root of the repo.
 +The output binary will be in `buck-out/gen/programs/`.
 +
 +## Testing
 +
 +You can run quick local smoke tests by executing the `playTest.sh` script from the `src/tests` directory.
 +Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the zstd and datagen binary.
 +For information on CI testing, please refer to TESTING.md
 +
 +## Status
 +
 +Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases.
 +Zstandard is considered safe for production environments.
 +
 +## License
 +
 +Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING).
 +
 +## Contributing
 +
 +The `dev` branch is the one where all contributions are merged before reaching `release`.
 +If you plan to propose a patch, please commit into the `dev` branch, or its own feature branch.
 +Direct commit to `release` are not permitted.
 +For more information, please read [CONTRIBUTING](CONTRIBUTING.md).
diff --cc sys/contrib/zstd/lib/Makefile
index 869d76630e68,000000000000..ef202183d843
mode 100644,000000..100644
--- a/sys/contrib/zstd/lib/Makefile
+++ b/sys/contrib/zstd/lib/Makefile
@@@ -1,451 -1,0 +1,357 @@@
 +# ################################################################
- # Copyright (c) 2015-2020, Yann Collet, Facebook, Inc.
++# Copyright (c) Yann Collet, Facebook, Inc.
 +# All rights reserved.
 +#
 +# This source code is licensed under both the BSD-style license (found in the
 +# LICENSE file in the root directory of this source tree) and the GPLv2 (found
 +# in the COPYING file in the root directory of this source tree).
 +# You may select, at your option, one of the above-listed licenses.
 +# ################################################################
 +
- .PHONY: default
- default: lib-release
- 
- # define silent mode as default (verbose mode with V=1 or VERBOSE=1)
- $(V)$(VERBOSE).SILENT:
- 
- # When cross-compiling from linux to windows,
- # one might need to specify TARGET_SYSTEM as "Windows."
- # Building from Fedora fails without it.
- # (but Ubuntu and Debian don't need to set anything)
- TARGET_SYSTEM ?= $(OS)
- 
- # Version numbers
- LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
- LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
- LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
- LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT)
- LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
- LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
- LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
- LIBVER := $(shell echo $(LIBVER_SCRIPT))
- VERSION?= $(LIBVER)
- CCVER := $(shell $(CC) --version)
- 
- # ZSTD_LIB_MINIFY is a helper variable that
- # configures a bunch of other variables to space-optimized defaults.
- ZSTD_LIB_MINIFY ?= 0
- ifneq ($(ZSTD_LIB_MINIFY), 0)
-   HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
-   ZSTD_LEGACY_SUPPORT ?= 0
-   ZSTD_LIB_DEPRECATED ?= 0
-   HUF_FORCE_DECOMPRESS_X1 ?= 1
-   ZSTD_FORCE_DECOMPRESS_SHORT ?= 1
-   ZSTD_NO_INLINE ?= 1
-   ZSTD_STRIP_ERROR_STRINGS ?= 1
- ifneq ($(HAVE_CC_OZ), 0)
-     # Some compilers (clang) support an even more space-optimized setting.
-     CFLAGS += -Oz
- else
-     CFLAGS += -Os
- endif
-   CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
-             -DDYNAMIC_BMI2=0 -DNDEBUG
- else
-   CFLAGS += -O3
- endif
- 
- DEBUGLEVEL ?= 0
- CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL)
- ifeq ($(TARGET_SYSTEM),Windows_NT)   # MinGW assumed
-   CPPFLAGS += -D__USE_MINGW_ANSI_STDIO   # compatibility with %zu formatting
- endif
- DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
-             -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
-             -Wstrict-prototypes -Wundef -Wpointer-arith \
-             -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
-             -Wredundant-decls -Wmissing-prototypes -Wc++-compat
- CFLAGS   += $(DEBUGFLAGS) $(MOREFLAGS)
- FLAGS     = $(CPPFLAGS) $(CFLAGS)
- 
- HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
- GREP_OPTIONS ?=
- ifeq ($HAVE_COLORNEVER, 1)
-   GREP_OPTIONS += --color=never
- endif
- GREP = grep $(GREP_OPTIONS)
- SED_ERE_OPT ?= -E
- 
- ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c))
- ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c))
- ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c))
- ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c))
- ZDEPR_FILES := $(sort $(wildcard deprecated/*.c))
- ZSTD_FILES := $(ZSTDCOMMON_FILES)
- 
- ifeq ($(findstring GCC,$(CCVER)),GCC)
- decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize
- endif
- 
 +# Modules
 +ZSTD_LIB_COMPRESSION ?= 1
 +ZSTD_LIB_DECOMPRESSION ?= 1
 +ZSTD_LIB_DICTBUILDER ?= 1
- ZSTD_LIB_DEPRECATED ?= 1
- 
- # Legacy support
- ZSTD_LEGACY_SUPPORT ?= 5
- ZSTD_LEGACY_MULTITHREADED_API ?= 0
- 
- # Build size optimizations
- HUF_FORCE_DECOMPRESS_X1 ?= 0
- HUF_FORCE_DECOMPRESS_X2 ?= 0
- ZSTD_FORCE_DECOMPRESS_SHORT ?= 0
- ZSTD_FORCE_DECOMPRESS_LONG ?= 0
*** 1832 LINES SKIPPED ***