latest upstream (1.4.7)

Also include fix for test failure on i686 and s390
https://github.com/facebook/zstd/pull/2432
This commit is contained in:
Pádraig Brady 2020-12-17 15:42:17 +00:00
parent b2a12f103c
commit 196d817011
6 changed files with 56 additions and 29 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
/zstd-1.4.2.tar.gz
/zstd-1.4.4.tar.gz
/zstd-1.4.5.tar.gz
/zstd-1.4.7.tar.gz

44
alignment.patch Normal file
View File

@ -0,0 +1,44 @@
From ae85676d44baee3d12168a5c929347b3836f2cf2 Mon Sep 17 00:00:00 2001
From: Nick Terrell <terrelln@fb.com>
Date: Thu, 17 Dec 2020 14:27:53 -0800
Subject: [PATCH] Fix alignment of scratchBuffer in HUF_compressWeights()
The scratch buffer must be 4-byte aligned. This causes test failures in
32-bit systems, where the stack isn't aligned.
Fixes Issue #2428.
---
lib/common/fse.h | 5 +++--
lib/compress/huf_compress.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/common/fse.h b/lib/common/fse.h
index 83a07847a..dd5fc44e8 100644
--- a/lib/common/fse.h
+++ b/lib/common/fse.h
@@ -335,9 +335,10 @@ size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue);
/* FSE_buildCTable_wksp() :
* Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`).
- * `wkspSize` must be >= `FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog)`.
+ * `wkspSize` must be >= `FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog)` of `unsigned`.
*/
-#define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * (maxSymbolValue + 2) + (1ull << tableLog))
+#define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (maxSymbolValue + 2 + (1ull << (tableLog - 2)))
+#define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog))
size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
#define FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) (sizeof(short) * (maxSymbolValue + 1) + (1ULL << maxTableLog) + 8)
diff --git a/lib/compress/huf_compress.c b/lib/compress/huf_compress.c
index abbcc3192..00c593d7e 100644
--- a/lib/compress/huf_compress.c
+++ b/lib/compress/huf_compress.c
@@ -69,7 +69,7 @@ static size_t HUF_compressWeights (void* dst, size_t dstSize, const void* weight
U32 tableLog = MAX_FSE_TABLELOG_FOR_HUFF_HEADER;
FSE_CTable CTable[FSE_CTABLE_SIZE_U32(MAX_FSE_TABLELOG_FOR_HUFF_HEADER, HUF_TABLELOG_MAX)];
- BYTE scratchBuffer[FSE_BUILD_CTABLE_WORKSPACE_SIZE(HUF_TABLELOG_MAX, MAX_FSE_TABLELOG_FOR_HUFF_HEADER)];
+ U32 scratchBuffer[FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(HUF_TABLELOG_MAX, MAX_FSE_TABLELOG_FOR_HUFF_HEADER)];
unsigned count[HUF_TABLELOG_MAX+1];
S16 norm[HUF_TABLELOG_MAX+1];

View File

@ -1,20 +0,0 @@
diff -Naur zstd-1.4.5.orig/lib/Makefile zstd-1.4.5/lib/Makefile
--- zstd-1.4.5.orig/lib/Makefile 2020-05-22 05:04:00.000000000 +0000
+++ zstd-1.4.5/lib/Makefile 2020-05-25 14:11:28.947300726 +0000
@@ -220,13 +220,14 @@
.PHONY: lib
lib : libzstd.a libzstd
-.PHONY: lib-mt
+# note : do not define lib-mt or lib-release as .PHONY
+# make does not consider implicit pattern rule for .PHONY target
+
%-mt : CPPFLAGS += -DZSTD_MULTITHREAD
%-mt : LDFLAGS += -pthread
%-mt : %
@echo multi-threading build completed
-.PHONY: lib-release
%-release : DEBUGFLAGS :=
%-release : %
@echo release build completed

View File

@ -1,7 +1,7 @@
diff -Naur zstd-1.4.5.orig/programs/zstd.1 zstd-1.4.5/programs/zstd.1
--- zstd-1.4.5.orig/programs/zstd.1 2020-05-22 05:04:00.000000000 +0000
+++ zstd-1.4.5/programs/zstd.1 2020-05-22 13:01:37.443798417 +0000
@@ -202,6 +202,14 @@
diff -Naur zstd-1.4.7.orig/programs/zstd.1 zstd-1.4.7/programs/zstd.1
--- zstd-1.4.7.orig/programs/zstd.1 2020-12-16 23:00:18.000000000 +0000
+++ zstd-1.4.7/programs/zstd.1 2020-12-17 15:15:22.586152398 +0000
@@ -208,6 +208,14 @@
.
.IP "\(bu" 4
\fB\-\-\fR: All arguments after \fB\-\-\fR are treated as files

View File

@ -1 +1 @@
SHA512 (zstd-1.4.5.tar.gz) = 417b813ade6c8436690bd9d6da34a9f87f50e7378752b72e63066befbee496392a4b72896fa56688d814f461871ab31d3c6637497ff2ed7a282d58513631a38b
SHA512 (zstd-1.4.7.tar.gz) = 43b2292e6518123bebfe0623ec8d7f832850ad1f4fd5b845328665330dd104574a27debd5530c204bf44d0d36737b3e57e07097e5ac6e8bb3bae4e9eeb0f2e0c

View File

@ -12,8 +12,8 @@
%endif
Name: zstd
Version: 1.4.5
Release: 3%{?dist}
Version: 1.4.7
Release: 1%{?dist}
Summary: Zstd compression library
License: BSD and GPLv2
@ -21,7 +21,7 @@ URL: https://github.com/facebook/zstd
Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch1: pzstd.1.patch
Patch2: lib-make.patch
Patch2: alignment.patch
BuildRequires: gcc gtest-devel
%if %{with pzstd}
@ -111,7 +111,6 @@ install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
%license COPYING LICENSE
%files -n lib%{name}-devel
%{_includedir}/zbuff.h
%{_includedir}/zdict.h
%{_includedir}/zstd.h
%{_includedir}/zstd_errors.h
@ -124,6 +123,9 @@ install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
%ldconfig_scriptlets -n lib%{name}
%changelog
* Thu Dec 17 2020 Pádraig Brady <P@draigBrady.com> - 1.4.7-1
- Latest upstream
* Mon May 25 2020 Pádraig Brady <P@draigBrady.com> - 1.4.5-3
- Build shared library with correct compiler flags