diff --git a/.gitignore b/.gitignore index 0c00884..c2ff4e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /zlib-1.2.11.tar.xz /zlib-1.2.12.tar.gz /zlib-1.2.12.tar.xz +/zlib-1.2.13.tar.xz diff --git a/sources b/sources index b24ca65..d5a4893 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (zlib-1.2.12.tar.xz) = 12940e81e988f7661da52fa20bdc333314ae86a621fdb748804a20840b065a1d6d984430f2d41f3a057de0effc6ff9bcf42f9ee9510b88219085f59cbbd082bd +SHA512 (zlib-1.2.13.tar.xz) = 9e7ac71a1824855ae526506883e439456b74ac0b811d54e94f6908249ba8719bec4c8d7672903c5280658b26cb6b5e93ecaaafe5cdc2980c760fa196773f0725 diff --git a/zlib-1.2.12-correct-inputs-provided-to-crc-func.patch b/zlib-1.2.12-correct-inputs-provided-to-crc-func.patch deleted file mode 100644 index 5581949..0000000 --- a/zlib-1.2.12-correct-inputs-provided-to-crc-func.patch +++ /dev/null @@ -1,54 +0,0 @@ -From ec3df00224d4b396e2ac6586ab5d25f673caa4c2 Mon Sep 17 00:00:00 2001 -From: Mark Adler -Date: Wed, 30 Mar 2022 11:14:53 -0700 -Subject: [PATCH] Correct incorrect inputs provided to the CRC functions. - -The previous releases of zlib were not sensitive to incorrect CRC -inputs with bits set above the low 32. This commit restores that -behavior, so that applications with such bugs will continue to -operate as before. ---- - crc32.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/crc32.c b/crc32.c -index a1bdce5..451887b 100644 ---- a/crc32.c -+++ b/crc32.c -@@ -630,7 +630,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) - #endif /* DYNAMIC_CRC_TABLE */ - - /* Pre-condition the CRC */ -- crc ^= 0xffffffff; -+ crc = (~crc) & 0xffffffff; - - /* Compute the CRC up to a word boundary. */ - while (len && ((z_size_t)buf & 7) != 0) { -@@ -749,7 +749,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) - #endif /* DYNAMIC_CRC_TABLE */ - - /* Pre-condition the CRC */ -- crc ^= 0xffffffff; -+ crc = (~crc) & 0xffffffff; - - #ifdef W - -@@ -1077,7 +1077,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2) - #ifdef DYNAMIC_CRC_TABLE - once(&made, make_crc_table); - #endif /* DYNAMIC_CRC_TABLE */ -- return multmodp(x2nmodp(len2, 3), crc1) ^ crc2; -+ return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); - } - - /* ========================================================================= */ -@@ -1112,5 +1112,5 @@ uLong crc32_combine_op(crc1, crc2, op) - uLong crc2; - uLong op; - { -- return multmodp(op, crc1) ^ crc2; -+ return multmodp(op, crc1) ^ (crc2 & 0xffffffff); - } --- -2.34.3 - diff --git a/zlib-1.2.12-fix-CVE-2022-37434.patch b/zlib-1.2.12-fix-CVE-2022-37434.patch deleted file mode 100644 index 4df04f7..0000000 --- a/zlib-1.2.12-fix-CVE-2022-37434.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- zlib-1.2.12/inflate.c.old 2022-08-09 10:30:18.831225181 +0000 -+++ zlib-1.2.12/inflate.c 2022-08-09 10:29:33.251225181 +0000 -@@ -792,8 +792,9 @@ int flush; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && -- state->head->extra != Z_NULL) { -- len = state->head->extra_len - state->length; -+ state->head->extra != Z_NULL && -+ (len = state->head->extra_len - state->length) < -+ state->head->extra_max) { - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); diff --git a/zlib-1.2.12-fix-configure.patch b/zlib-1.2.12-fix-configure.patch deleted file mode 100644 index d1b72cf..0000000 --- a/zlib-1.2.12-fix-configure.patch +++ /dev/null @@ -1,46 +0,0 @@ -From a6cd9e1230acdb535bd57bbc350020da3d24eaf3 Mon Sep 17 00:00:00 2001 -From: Sam James -Date: Mon, 28 Mar 2022 08:40:45 +0100 -Subject: [PATCH] Fix CC logic in configure - -In https://github.com/madler/zlib/commit/e9a52aa129efe3834383e415580716a7c4027f8d, -the logic was changed to try check harder for GCC, but it dropped -the default setting of cc=${CC}. It was throwing away any pre-set CC value as -a result. - -The rest of the script then cascades down a bad path because it's convinced -it's not GCC or a GCC-like compiler. - -This led to e.g. misdetection of inability to build shared libs -for say, multilib cases (w/ CC being one thing from the environment being used -for one test (e.g. x86_64-unknown-linux-gnu-gcc -m32 and then 'cc' used for -shared libs (but missing "-m32"!)). Obviously just one example of how -the old logic could break. - -This restores the old default of 'CC' if nothing overrides it later -in configure. - -Bug: https://bugs.gentoo.org/836308 -Signed-off-by: Sam James ---- - configure | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/configure b/configure -index a21be36..cdf0e5b 100755 ---- a/configure -+++ b/configure -@@ -185,7 +185,10 @@ if test -z "$CC"; then - else - cc=${CROSS_PREFIX}cc - fi -+else -+ cc=${CC} - fi -+ - cflags=${CFLAGS-"-O3"} - # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure - case "$cc" in --- -2.34.3 - diff --git a/zlib-1.2.12-IBM-Z-hw-accelerated-deflate.patch b/zlib-1.2.13-IBM-Z-hw-accelerated-deflate.patch similarity index 94% rename from zlib-1.2.12-IBM-Z-hw-accelerated-deflate.patch rename to zlib-1.2.13-IBM-Z-hw-accelerated-deflate.patch index bf30042..3f6f1dc 100644 --- a/zlib-1.2.12-IBM-Z-hw-accelerated-deflate.patch +++ b/zlib-1.2.13-IBM-Z-hw-accelerated-deflate.patch @@ -1,4 +1,4 @@ -From e6aed68ff815be74855ec6a19d6ae35065a4adb4 Mon Sep 17 00:00:00 2001 +From 48c5416a4e21227b8e1aa24fd819d4619a90e1a9 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Wed, 18 Jul 2018 13:14:07 +0200 Subject: [PATCH] Add support for IBM Z hardware-accelerated deflate @@ -100,10 +100,10 @@ updatewindow and made ZLIB_INTERNAL. configure | 24 + contrib/README.contrib | 4 + contrib/s390/README.txt | 17 + - contrib/s390/dfltcc.c | 996 ++++++++++++++++++++++++++++++++++ + contrib/s390/dfltcc.c | 995 ++++++++++++++++++++++++++++++++++ contrib/s390/dfltcc.h | 81 +++ contrib/s390/dfltcc_deflate.h | 55 ++ - deflate.c | 81 ++- + deflate.c | 82 ++- deflate.h | 12 + gzguts.h | 4 + inflate.c | 87 ++- @@ -119,10 +119,10 @@ updatewindow and made ZLIB_INTERNAL. create mode 100644 contrib/s390/dfltcc_deflate.h diff --git a/Makefile.in b/Makefile.in -index fd28bbfbf..66e3a8057 100644 +index 408954d..a811c10 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -143,6 +143,14 @@ match.lo: match.S +@@ -139,6 +139,14 @@ match.lo: match.S mv _match.o match.lo rm -f _match.s @@ -134,11 +134,11 @@ index fd28bbfbf..66e3a8057 100644 + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/dfltcc.o $(SRCDIR)contrib/s390/dfltcc.c + -@mv objs/dfltcc.o $@ + - example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c + crc32_test.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/crc32_test.c diff --git a/compress.c b/compress.c -index e2db404ab..78fc6568f 100644 +index 2ad5326..179ee27 100644 --- a/compress.c +++ b/compress.c @@ -5,9 +5,15 @@ @@ -158,8 +158,8 @@ index e2db404ab..78fc6568f 100644 /* =========================================================================== Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte -@@ -81,6 +87,12 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) - uLong ZEXPORT compressBound (sourceLen) +@@ -81,6 +87,12 @@ int ZEXPORT compress(dest, destLen, source, sourceLen) + uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { + uLong complen = DEFLATE_BOUND_COMPLEN(sourceLen); @@ -172,10 +172,10 @@ index e2db404ab..78fc6568f 100644 (sourceLen >> 25) + 13; } diff --git a/configure b/configure -index 3fa3e8618..cdf0e5b6b 100755 +index 45d51e5..ab3204a 100755 --- a/configure +++ b/configure -@@ -115,6 +115,7 @@ case "$1" in +@@ -118,6 +118,7 @@ case "$1" in echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log @@ -183,7 +183,7 @@ index 3fa3e8618..cdf0e5b6b 100755 exit 0 ;; -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; -@@ -139,6 +140,16 @@ case "$1" in +@@ -142,6 +143,16 @@ case "$1" in -w* | --warn) warn=1; shift ;; -d* | --debug) debug=1; shift ;; --sanitize) sanitize=1; shift ;; @@ -200,7 +200,7 @@ index 3fa3e8618..cdf0e5b6b 100755 *) echo "unknown option: $1" | tee -a configure.log echo "$0 --help for help" | tee -a configure.log -@@ -836,6 +847,19 @@ EOF +@@ -828,6 +839,19 @@ EOF fi fi @@ -217,14 +217,14 @@ index 3fa3e8618..cdf0e5b6b 100755 + echo "Checking for sys/sdt.h ... No." | tee -a configure.log +fi + - # show the results in the log + # test to see if we can use a gnu indirection function to detect and load optimized code at runtime echo >> configure.log - echo ALL = $ALL >> configure.log + cat > $test.c < +@@ -55,6 +55,10 @@ puff/ by Mark Adler Small, low memory usage inflate. Also serves to provide an unambiguous description of the deflate format. @@ -237,7 +237,7 @@ index 335e43508..130a28bdb 100644 diff --git a/contrib/s390/README.txt b/contrib/s390/README.txt new file mode 100644 -index 000000000..48be008bd +index 0000000..48be008 --- /dev/null +++ b/contrib/s390/README.txt @@ -0,0 +1,17 @@ @@ -260,10 +260,10 @@ index 000000000..48be008bd +DFLTCC_LEVEL_MASK to 0x7e at run time. diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c new file mode 100644 -index 000000000..fe81bebfe +index 0000000..aa0b7a3 --- /dev/null +++ b/contrib/s390/dfltcc.c -@@ -0,0 +1,996 @@ +@@ -0,0 +1,995 @@ +/* dfltcc.c - SystemZ DEFLATE CONVERSION CALL support. */ + +/* @@ -890,7 +890,7 @@ index 000000000..fe81bebfe + state->bits = param->sbb; + state->whave = param->hl; + state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1); -+ state->check = state->flags ? ZSWAP32(param->cv) : param->cv; ++ strm->adler = state->check = state->flags ? ZSWAP32(param->cv) : param->cv; + if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { + /* Report an error if stream is corrupted */ + state->mode = BAD; @@ -968,7 +968,6 @@ index 000000000..fe81bebfe +__attribute__((constructor)) local void init_globals OF((void)); +__attribute__((constructor)) local void init_globals(void) +{ -+ const char *endptr; + const char *env; + register char r0 __asm__("r0"); + @@ -1262,7 +1261,7 @@ index 000000000..fe81bebfe +} diff --git a/contrib/s390/dfltcc.h b/contrib/s390/dfltcc.h new file mode 100644 -index 000000000..da26612ca +index 0000000..da26612 --- /dev/null +++ b/contrib/s390/dfltcc.h @@ -0,0 +1,81 @@ @@ -1349,7 +1348,7 @@ index 000000000..da26612ca +#endif diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h new file mode 100644 -index 000000000..46acfc550 +index 0000000..46acfc5 --- /dev/null +++ b/contrib/s390/dfltcc_deflate.h @@ -0,0 +1,55 @@ @@ -1409,7 +1408,7 @@ index 000000000..46acfc550 + +#endif diff --git a/deflate.c b/deflate.c -index 6ac891d7d..afca18ce2 100644 +index 4a689db..9fd3bdb 100644 --- a/deflate.c +++ b/deflate.c @@ -61,15 +61,30 @@ const char deflate_copyright[] = @@ -1456,9 +1455,9 @@ index 6ac891d7d..afca18ce2 100644 local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); - #ifdef ASMV - # pragma message("Assembler code may have bugs -- use at your own risk") -@@ -299,7 +313,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + local uInt longest_match OF((deflate_state *s, IPos cur_match)); + +@@ -295,7 +309,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, return Z_STREAM_ERROR; } if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ @@ -1467,16 +1466,16 @@ index 6ac891d7d..afca18ce2 100644 if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; -@@ -316,7 +330,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, +@@ -312,7 +326,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->window = (Bytef *) ZALLOC_WINDOW(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); -@@ -434,6 +448,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +@@ -430,6 +444,7 @@ int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) /* when using zlib wrappers, compute Adler-32 for provided dictionary */ if (wrap == 1) strm->adler = adler32(strm->adler, dictionary, dictLength); @@ -1484,7 +1483,7 @@ index 6ac891d7d..afca18ce2 100644 s->wrap = 0; /* avoid computing Adler-32 in read_buf */ /* if dictionary would fill window, just replace the history */ -@@ -492,6 +507,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +@@ -488,6 +503,7 @@ int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) if (deflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1492,7 +1491,7 @@ index 6ac891d7d..afca18ce2 100644 s = strm->state; len = s->strstart + s->lookahead; if (len > s->w_size) -@@ -538,6 +554,8 @@ int ZEXPORT deflateResetKeep (strm) +@@ -534,6 +550,8 @@ int ZEXPORT deflateResetKeep(strm) _tr_init(s); @@ -1501,7 +1500,7 @@ index 6ac891d7d..afca18ce2 100644 return Z_OK; } -@@ -613,6 +631,7 @@ int ZEXPORT deflateParams(strm, level, strategy) +@@ -609,6 +627,7 @@ int ZEXPORT deflateParams(strm, level, strategy) { deflate_state *s; compress_func func; @@ -1509,7 +1508,7 @@ index 6ac891d7d..afca18ce2 100644 if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; -@@ -625,15 +644,18 @@ int ZEXPORT deflateParams(strm, level, strategy) +@@ -621,15 +640,18 @@ int ZEXPORT deflateParams(strm, level, strategy) if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } @@ -1532,25 +1531,31 @@ index 6ac891d7d..afca18ce2 100644 return Z_BUF_ERROR; } if (s->level != level) { -@@ -700,6 +722,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; -+ DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen); +@@ -705,11 +727,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen) + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; ++ DEFLATE_BOUND_ADJUST_COMPLEN(strm, fixedlen, sourceLen); - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; ++ DEFLATE_BOUND_ADJUST_COMPLEN(strm, storelen, sourceLen); + + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) -@@ -741,7 +764,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen) +@@ -751,7 +775,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen) } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ - if (s->w_bits != 15 || s->hash_bits != 8 + 7) + if (DEFLATE_NEED_CONSERVATIVE_BOUND(strm) || + s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen; - /* default settings: return tight bound for that case */ -@@ -768,7 +792,7 @@ local void putShortMSB (s, b) + /* default settings: return tight bound for that case -- ~0.03% overhead +@@ -779,7 +804,7 @@ local void putShortMSB(s, b) * applications may wish to modify it to avoid allocating a large * strm->next_out buffer and copying into it. (See also read_buf()). */ @@ -1559,7 +1564,7 @@ index 6ac891d7d..afca18ce2 100644 z_streamp strm; { unsigned len; -@@ -1040,7 +1064,8 @@ int ZEXPORT deflate (strm, flush) +@@ -1051,7 +1076,8 @@ int ZEXPORT deflate(strm, flush) (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; @@ -1569,7 +1574,7 @@ index 6ac891d7d..afca18ce2 100644 s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s->strategy == Z_RLE ? deflate_rle(s, flush) : (*(configuration_table[s->level].func))(s, flush); -@@ -1087,7 +1112,6 @@ int ZEXPORT deflate (strm, flush) +@@ -1098,7 +1124,6 @@ int ZEXPORT deflate(strm, flush) } if (flush != Z_FINISH) return Z_OK; @@ -1577,7 +1582,7 @@ index 6ac891d7d..afca18ce2 100644 /* Write the trailer */ #ifdef GZIP -@@ -1103,7 +1127,7 @@ int ZEXPORT deflate (strm, flush) +@@ -1114,7 +1139,7 @@ int ZEXPORT deflate(strm, flush) } else #endif @@ -1586,7 +1591,7 @@ index 6ac891d7d..afca18ce2 100644 putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } -@@ -1112,7 +1136,11 @@ int ZEXPORT deflate (strm, flush) +@@ -1123,7 +1148,11 @@ int ZEXPORT deflate(strm, flush) * to flush the rest. */ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ @@ -1599,7 +1604,7 @@ index 6ac891d7d..afca18ce2 100644 } /* ========================================================================= */ -@@ -1129,9 +1157,9 @@ int ZEXPORT deflateEnd (strm) +@@ -1140,9 +1169,9 @@ int ZEXPORT deflateEnd(strm) TRY_FREE(strm, strm->state->pending_buf); TRY_FREE(strm, strm->state->head); TRY_FREE(strm, strm->state->prev); @@ -1611,7 +1616,7 @@ index 6ac891d7d..afca18ce2 100644 strm->state = Z_NULL; return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -@@ -1161,13 +1189,13 @@ int ZEXPORT deflateCopy (dest, source) +@@ -1172,13 +1201,13 @@ int ZEXPORT deflateCopy(dest, source) zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); @@ -1628,7 +1633,7 @@ index 6ac891d7d..afca18ce2 100644 ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); -@@ -1214,7 +1242,8 @@ local unsigned read_buf(strm, buf, size) +@@ -1225,7 +1254,8 @@ local unsigned read_buf(strm, buf, size) strm->avail_in -= len; zmemcpy(buf, strm->next_in, len); @@ -1639,7 +1644,7 @@ index 6ac891d7d..afca18ce2 100644 } #ifdef GZIP diff --git a/deflate.h b/deflate.h -index 1a06cd5f2..f92750ca6 100644 +index 1a06cd5..f92750c 100644 --- a/deflate.h +++ b/deflate.h @@ -299,6 +299,7 @@ void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); @@ -1667,7 +1672,7 @@ index 1a06cd5f2..f92750ca6 100644 + #endif /* DEFLATE_H */ diff --git a/gzguts.h b/gzguts.h -index 57faf3716..581f2b631 100644 +index 57faf37..581f2b6 100644 --- a/gzguts.h +++ b/gzguts.h @@ -153,7 +153,11 @@ @@ -1683,7 +1688,7 @@ index 57faf3716..581f2b631 100644 /* gzip modes, also provide a little integrity check on the passed structure */ #define GZ_NONE 0 diff --git a/inflate.c b/inflate.c -index 7be8c6366..a0e14e292 100644 +index 8acbef4..918dfa7 100644 --- a/inflate.c +++ b/inflate.c @@ -85,6 +85,24 @@ @@ -1719,7 +1724,7 @@ index 7be8c6366..a0e14e292 100644 Tracev((stderr, "inflate: reset\n")); return Z_OK; } -@@ -183,7 +202,7 @@ int windowBits; +@@ -185,7 +204,7 @@ int windowBits; if (windowBits && (windowBits < 8 || windowBits > 15)) return Z_STREAM_ERROR; if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { @@ -1728,7 +1733,7 @@ index 7be8c6366..a0e14e292 100644 state->window = Z_NULL; } -@@ -222,7 +241,7 @@ int stream_size; +@@ -224,7 +243,7 @@ int stream_size; strm->zfree = zcfree; #endif state = (struct inflate_state FAR *) @@ -1737,7 +1742,7 @@ index 7be8c6366..a0e14e292 100644 if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; -@@ -231,7 +250,7 @@ int stream_size; +@@ -233,7 +252,7 @@ int stream_size; state->mode = HEAD; /* to pass state test in inflateReset2() */ ret = inflateReset2(strm, windowBits); if (ret != Z_OK) { @@ -1746,7 +1751,7 @@ index 7be8c6366..a0e14e292 100644 strm->state = Z_NULL; } return ret; -@@ -253,6 +272,7 @@ int value; +@@ -255,6 +274,7 @@ int value; struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1754,7 +1759,7 @@ index 7be8c6366..a0e14e292 100644 state = (struct inflate_state FAR *)strm->state; if (bits < 0) { state->hold = 0; -@@ -380,6 +400,27 @@ void makefixed() +@@ -382,6 +402,27 @@ void makefixed() } #endif /* MAKEFIXED */ @@ -1782,7 +1787,7 @@ index 7be8c6366..a0e14e292 100644 /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called -@@ -404,20 +445,7 @@ unsigned copy; +@@ -406,20 +447,7 @@ unsigned copy; state = (struct inflate_state FAR *)strm->state; @@ -1804,7 +1809,7 @@ index 7be8c6366..a0e14e292 100644 /* copy state->wsize or less output bytes into the circular window */ if (copy >= state->wsize) { -@@ -860,6 +888,7 @@ int flush; +@@ -863,6 +891,7 @@ int flush; if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; /* fallthrough */ case TYPEDO: @@ -1812,7 +1817,7 @@ index 7be8c6366..a0e14e292 100644 if (state->last) { BYTEBITS(); state->mode = CHECK; -@@ -1221,7 +1250,7 @@ int flush; +@@ -1224,7 +1253,7 @@ int flush; out -= left; strm->total_out += out; state->total += out; @@ -1821,7 +1826,7 @@ index 7be8c6366..a0e14e292 100644 strm->adler = state->check = UPDATE_CHECK(state->check, put - out, out); out = left; -@@ -1276,8 +1305,9 @@ int flush; +@@ -1279,8 +1308,9 @@ int flush; */ inf_leave: RESTORE(); @@ -1833,7 +1838,7 @@ index 7be8c6366..a0e14e292 100644 if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; -@@ -1287,7 +1317,7 @@ int flush; +@@ -1290,7 +1320,7 @@ int flush; strm->total_in += in; strm->total_out += out; state->total += out; @@ -1842,7 +1847,7 @@ index 7be8c6366..a0e14e292 100644 strm->adler = state->check = UPDATE_CHECK(state->check, strm->next_out - out, out); strm->data_type = (int)state->bits + (state->last ? 64 : 0) + -@@ -1305,8 +1335,8 @@ z_streamp strm; +@@ -1308,8 +1338,8 @@ z_streamp strm; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; @@ -1853,7 +1858,7 @@ index 7be8c6366..a0e14e292 100644 strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; -@@ -1485,6 +1515,7 @@ z_streamp strm; +@@ -1488,6 +1518,7 @@ z_streamp strm; struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1861,7 +1866,7 @@ index 7be8c6366..a0e14e292 100644 state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0; } -@@ -1505,21 +1536,22 @@ z_streamp source; +@@ -1508,21 +1539,22 @@ z_streamp source; /* allocate space */ copy = (struct inflate_state FAR *) @@ -1888,7 +1893,7 @@ index 7be8c6366..a0e14e292 100644 copy->strm = dest; if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { -@@ -1576,6 +1608,7 @@ z_streamp strm; +@@ -1579,6 +1611,7 @@ z_streamp strm; if (inflateStateCheck(strm)) return -(1L << 16); @@ -1897,7 +1902,7 @@ index 7be8c6366..a0e14e292 100644 return (long)(((unsigned long)((long)state->back)) << 16) + (state->mode == COPY ? state->length : diff --git a/inflate.h b/inflate.h -index f127b6b1f..519ed3535 100644 +index f127b6b..519ed35 100644 --- a/inflate.h +++ b/inflate.h @@ -124,3 +124,5 @@ struct inflate_state { @@ -1907,7 +1912,7 @@ index f127b6b1f..519ed3535 100644 + +int ZLIB_INTERNAL inflate_ensure_window OF((struct inflate_state *state)); diff --git a/test/infcover.c b/test/infcover.c -index 2be01646c..a208219dc 100644 +index 2be0164..a208219 100644 --- a/test/infcover.c +++ b/test/infcover.c @@ -373,7 +373,7 @@ local void cover_support(void) @@ -1929,7 +1934,7 @@ index 2be01646c..a208219dc 100644 static unsigned int next = 0; static unsigned char dat[] = {0x63, 0, 2, 0}; diff --git a/test/minigzip.c b/test/minigzip.c -index e22fb08c0..4b5f4efed 100644 +index a649d2b..964408a 100644 --- a/test/minigzip.c +++ b/test/minigzip.c @@ -132,7 +132,11 @@ static void pwinerror (s) @@ -1945,7 +1950,7 @@ index e22fb08c0..4b5f4efed 100644 #ifdef MAXSEG_64K diff --git a/trees.c b/trees.c -index 8b438cce4..84c1b4732 100644 +index 5f305c4..4924bdf 100644 --- a/trees.c +++ b/trees.c @@ -149,8 +149,6 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, @@ -1971,7 +1976,7 @@ index 8b438cce4..84c1b4732 100644 /* the arguments must not have side effects */ -@@ -1134,7 +1139,7 @@ local int detect_data_type(s) +@@ -1133,7 +1138,7 @@ local int detect_data_type(s) * method would use a table) * IN assertion: 1 <= len <= 15 */ @@ -1980,7 +1985,7 @@ index 8b438cce4..84c1b4732 100644 unsigned code; /* the value to invert */ int len; /* its bit length */ { -@@ -1166,7 +1171,7 @@ local void bi_flush(s) +@@ -1165,7 +1170,7 @@ local void bi_flush(s) /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ @@ -1990,7 +1995,7 @@ index 8b438cce4..84c1b4732 100644 { if (s->bi_valid > 8) { diff --git a/zutil.h b/zutil.h -index d9a20ae1b..bc83f59d0 100644 +index 0bc7f4e..75eb4df 100644 --- a/zutil.h +++ b/zutil.h @@ -87,6 +87,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ @@ -2002,3 +2007,6 @@ index d9a20ae1b..bc83f59d0 100644 /* target dependencies */ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +-- +2.37.3 + diff --git a/zlib-1.2.11-optimized-s390.patch b/zlib-1.2.13-optimized-s390.patch similarity index 75% rename from zlib-1.2.11-optimized-s390.patch rename to zlib-1.2.13-optimized-s390.patch index 3999592..6e8fd46 100644 --- a/zlib-1.2.11-optimized-s390.patch +++ b/zlib-1.2.13-optimized-s390.patch @@ -1,11 +1,9 @@ -diff --git a/deflate.c b/deflate.c -index 1ec7614..b724c8d 100644 ---- a/deflate.c -+++ b/deflate.c -@@ -1322,15 +1322,16 @@ local void lm_init (s) - #define longest_match longest_match_default - #endif /* Z_POWER_OPT */ - +--- zlib-1.2.13/deflate.c.old 2022-11-24 16:41:34.527200490 +0000 ++++ zlib-1.2.13/deflate.c 2022-11-24 16:43:28.064200490 +0000 +@@ -1305,15 +1305,16 @@ local void lm_init(s) + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ -local uInt longest_match(s, cur_match) +local uInt longest_match(s, pcur_match) deflate_state *s; @@ -22,17 +20,17 @@ index 1ec7614..b724c8d 100644 int nice_match = s->nice_match; /* stop if match long enough */ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? s->strstart - (IPos)MAX_DIST(s) : NIL; -@@ -1256,12 +1257,12 @@ local uInt longest_match(s, cur_match) +@@ -1328,12 +1329,12 @@ local uInt longest_match(s, cur_match) * Try with and without -DUNALIGNED_OK to check. */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; -- register ush scan_end = *(ushf*)(scan+best_len-1); +- register ush scan_end = *(ushf*)(scan + best_len - 1); + register uInt scan_start = *(ushf*)scan; + register uInt scan_end = *(ushf*)(scan+best_len-1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; -- register Byte scan_end1 = scan[best_len-1]; +- register Byte scan_end1 = scan[best_len - 1]; - register Byte scan_end = scan[best_len]; + register uInt scan_end1 = scan[best_len-1]; + register uInt scan_end = scan[best_len]; diff --git a/zlib-1.2.12-power-optimizations.patch b/zlib-1.2.13-power-optimizations.patch similarity index 63% rename from zlib-1.2.12-power-optimizations.patch rename to zlib-1.2.13-power-optimizations.patch index d69117f..09f7c4d 100644 --- a/zlib-1.2.12-power-optimizations.patch +++ b/zlib-1.2.13-power-optimizations.patch @@ -1,7 +1,7 @@ -From a4d799105cf4fcc16affea4321d1690d9791e3a4 Mon Sep 17 00:00:00 2001 -From: Rogerio Alves -Date: Wed, 20 Nov 2019 10:35:40 -0300 -Subject: [PATCH 1/9] Preparation for Power optimizations +From 7edf70d6b010dd803d324bf90f5241a44bec3df7 Mon Sep 17 00:00:00 2001 +From: Manjunath S Matti +Date: Tue, 15 Nov 2022 02:45:53 -0600 +Subject: [PATCH 1/3] Preparation for Power optimizations Optimized functions for Power will make use of GNU indirect functions, an extension to support different implementations of the same function, @@ -13,32 +13,35 @@ macro under `contrib/gcc`. This can be reused by other archs as well. Author: Matheus Castanho Author: Rogerio Alves +Signed-off-by: Manjunath Matti --- - CMakeLists.txt | 67 ++++++++++++++++++++++++++++++++++++++++++ - configure | 66 +++++++++++++++++++++++++++++++++++++++++ + CMakeLists.txt | 71 ++++++++++++++++++++++++++++++++++++++++++ + configure | 66 +++++++++++++++++++++++++++++++++++++++ contrib/README.contrib | 8 +++++ - contrib/gcc/zifunc.h | 60 +++++++++++++++++++++++++++++++++++++ + contrib/gcc/zifunc.h | 60 +++++++++++++++++++++++++++++++++++ contrib/power/power.h | 4 +++ - 5 files changed, 205 insertions(+) + 5 files changed, 209 insertions(+) create mode 100644 contrib/gcc/zifunc.h create mode 100644 contrib/power/power.h diff --git a/CMakeLists.txt b/CMakeLists.txt -index e6fbb37..f15782e 100644 +index b412dc7..e313f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -7,6 +7,7 @@ set(VERSION "1.2.12") +@@ -5,6 +5,8 @@ project(zlib C) + + set(VERSION "1.2.13") - option(ASM686 "Enable building i686 assembly implementation") - option(AMD64 "Enable building amd64 assembly implementation") +option(POWER "Enable building power implementation") - ++ set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -@@ -140,6 +141,72 @@ if(CMAKE_COMPILER_IS_GNUCC) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() + set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") +@@ -126,6 +128,75 @@ if(NOT MINGW) + ) + endif() + ++if(CMAKE_COMPILER_IS_GNUCC) + + # test to see if we can use a GNU indirect function to detect and load optimized code at runtime + CHECK_C_SOURCE_COMPILES(" @@ -105,17 +108,19 @@ index e6fbb37..f15782e 100644 + set(ZLIB_SRCS ${ZLIB_SRCS} ${ZLIB_POWER8} ${ZLIB_POWER9}) + endif() + endif() - endif() - - if(MSVC) ++endif() ++ + # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) + string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" diff --git a/configure b/configure -index 52ff4a0..01ffdf6 100755 +index fa4d5da..9ee7008 100755 --- a/configure +++ b/configure -@@ -844,6 +844,73 @@ EOF +@@ -828,6 +828,72 @@ EOF fi fi - + +# test to see if we can use a gnu indirection function to detect and load optimized code at runtime +echo >> configure.log +cat > $test.c < $test.c << EOF - #include + # show the results in the log + echo >> configure.log + echo ALL = $ALL >> configure.log diff --git a/contrib/README.contrib b/contrib/README.contrib -index 335e435..12d2f83 100644 +index 5e5f950..c57b520 100644 --- a/contrib/README.contrib +++ b/contrib/README.contrib @@ -11,6 +11,10 @@ ada/ by Dmitriy Anisimkov @@ -289,21 +293,25 @@ index 0000000..b42c7d6 + * For conditions of distribution and use, see copyright notice in zlib.h + */ -- -2.34.3 +2.37.3 - -From 7429e4962c1948527a21ce77624a2ec2a85d5940 Mon Sep 17 00:00:00 2001 -From: Daniel Black -Date: Wed, 10 Jan 2018 10:50:39 +1100 -Subject: [PATCH 2/9] Add Power8+ optimized crc32 +From 2b843de4ffa241edc20877f3ec47e75c9ed13ec8 Mon Sep 17 00:00:00 2001 +From: Manjunath S Matti +Date: Wed, 16 Nov 2022 03:53:53 -0600 +Subject: [PATCH 2/3] Add Power8+ optimized crc32 This commit adds an optimized version for the crc32 function based on crc32-vpmsum from https://github.com/antonblanchard/crc32-vpmsum/ -This is the C implementation created by Rogerio Alves +This is the C implementation created by Rogerio Alves + It makes use of vector instructions to speed up CRC32 algorithm. + +Author: Rogerio Alves +Signed-off-by: Manjunath Matti --- + .gitignore | 3 + CMakeLists.txt | 7 +- Makefile.in | 43 +- configure | 7 +- @@ -323,10 +331,10 @@ It makes use of vector instructions to speed up CRC32 algorithm. create mode 100644 test/crc32_test.c diff --git a/CMakeLists.txt b/CMakeLists.txt -index f15782e..581e1fa 100644 +index e313f95..4ba992b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -184,7 +184,8 @@ if(CMAKE_COMPILER_IS_GNUCC) +@@ -172,7 +172,8 @@ if(CMAKE_COMPILER_IS_GNUCC) if(POWER8) add_definitions(-DZ_POWER8) @@ -336,7 +344,7 @@ index f15782e..581e1fa 100644 set_source_files_properties( ${ZLIB_POWER8} -@@ -301,6 +302,10 @@ add_executable(example test/example.c) +@@ -269,6 +270,10 @@ add_executable(example test/example.c) target_link_libraries(example zlib) add_test(example example) @@ -348,10 +356,10 @@ index f15782e..581e1fa 100644 target_link_libraries(minigzip zlib) diff --git a/Makefile.in b/Makefile.in -index 3d858aa..1694304 100644 +index 7d2713f..408954d 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -75,11 +75,11 @@ PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) +@@ -71,11 +71,11 @@ PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) all: static shared @@ -366,54 +374,53 @@ index 3d858aa..1694304 100644 check: test -@@ -87,7 +87,7 @@ test: all teststatic testshared +@@ -83,7 +83,7 @@ test: all teststatic testshared teststatic: static @TMPST=tmpst_$$; \ -- if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ -+ if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST && ./crc32_test; then \ +- if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \ ++ if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST && ${QEMU_RUN} ./crc32_test; then \ echo ' *** zlib test OK ***'; \ else \ echo ' *** zlib test FAILED ***'; false; \ -@@ -100,7 +100,7 @@ testshared: shared +@@ -96,7 +96,7 @@ testshared: shared DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ TMPSH=tmpsh_$$; \ -- if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ -+ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH && ./crc32_testsh; then \ +- if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \ ++ if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH && ${QEMU_RUN} ./crc32_testsh; then \ echo ' *** zlib shared test OK ***'; \ else \ echo ' *** zlib shared test FAILED ***'; false; \ -@@ -109,7 +109,7 @@ testshared: shared +@@ -105,7 +105,7 @@ testshared: shared test64: all64 @TMP64=tmp64_$$; \ -- if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ -+ if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64 && ./crc32_test64; then \ +- if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \ ++ if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64 && ${QEMU_RUN} ./crc32_test64; then \ echo ' *** zlib 64-bit test OK ***'; \ else \ echo ' *** zlib 64-bit test FAILED ***'; false; \ -@@ -143,6 +143,9 @@ match.lo: match.S +@@ -139,12 +139,18 @@ match.lo: match.S mv _match.o match.lo rm -f _match.s - + +crc32_test.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/crc32_test.c + - dfltcc.o: $(SRCDIR)contrib/s390/dfltcc.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)contrib/s390/dfltcc.c - -@@ -157,6 +160,9 @@ example.o: $(SRCDIR)test/example.c $(SRC + example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c + minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c - + +crc32_test64.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/crc32_test.c + example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c - -@@ -162,6 +168,9 @@ adler32.o: $(SRCDIR)adler32.c + +@@ -158,6 +164,9 @@ adler32.o: $(SRCDIR)adler32.c crc32.o: $(SRCDIR)crc32.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c @@ -423,7 +430,7 @@ index 3d858aa..1694304 100644 deflate.o: $(SRCDIR)deflate.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c -@@ -212,6 +221,11 @@ crc32.lo: $(SRCDIR)crc32.c +@@ -208,6 +217,11 @@ crc32.lo: $(SRCDIR)crc32.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c -@mv objs/crc32.o $@ @@ -435,7 +442,7 @@ index 3d858aa..1694304 100644 deflate.lo: $(SRCDIR)deflate.c -@mkdir objs 2>/dev/null || test -d objs $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c -@@ -285,18 +299,27 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a +@@ -281,18 +295,27 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a ln -s $@ $(SHAREDLIBM) -@rmdir objs @@ -452,10 +459,10 @@ index 3d858aa..1694304 100644 + $(CC) $(CFLAGS) -o $@ crc32_test.o -L. $(SHAREDLIBV) + examplesh$(EXE): example.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) +crc32_test64$(EXE): crc32_test64.o $(STATICLIB) + $(CC) $(CFLAGS) -o $@ crc32_test64.o $(TEST_LDFLAGS) @@ -463,7 +470,7 @@ index 3d858aa..1694304 100644 example64$(EXE): example64.o $(STATICLIB) $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) -@@ -366,8 +389,8 @@ zconf: $(SRCDIR)zconf.h.in +@@ -362,8 +385,8 @@ zconf: $(SRCDIR)zconf.h.in mostlyclean: clean clean: rm -f *.o *.lo *~ \ @@ -474,7 +481,7 @@ index 3d858aa..1694304 100644 infcover \ libz.* foo.gz so_locations \ _match.s maketree contrib/infback9/*.o -@@ -389,7 +412,7 @@ tags: +@@ -385,7 +408,7 @@ tags: adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h @@ -483,7 +490,7 @@ index 3d858aa..1694304 100644 crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h -@@ -399,7 +422,7 @@ trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)tr +@@ -395,7 +418,7 @@ trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)tr adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h @@ -493,10 +500,10 @@ index 3d858aa..1694304 100644 deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h diff --git a/configure b/configure -index 01ffdf6..914d9f4 100755 +index 9ee7008..45d51e5 100755 --- a/configure +++ b/configure -@@ -863,6 +863,9 @@ cat > $test.c < $test.c < @@ -2550,10 +2557,10 @@ index b42c7d6..79123aa 100644 + +unsigned long _crc32_z_power8(unsigned long, const Bytef *, z_size_t); diff --git a/crc32.c b/crc32.c -index a1bdce5..ae7b7e7 100644 +index f8357b0..4e5830b 100644 --- a/crc32.c +++ b/crc32.c -@@ -736,6 +736,13 @@ local z_word_t crc_word_big(data) +@@ -745,6 +745,13 @@ local z_word_t crc_word_big(data) #endif /* ========================================================================= */ @@ -2567,7 +2574,7 @@ index a1bdce5..ae7b7e7 100644 unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; -@@ -1057,6 +1064,11 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) +@@ -1066,6 +1073,11 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) return crc ^ 0xffffffff; } @@ -2791,13 +2798,12 @@ index 0000000..3155553 + return 0; +} -- -2.34.3 +2.37.3 - -From aae9203a38e8ba5933cde40918f6157cf90e78fb Mon Sep 17 00:00:00 2001 +From e8c61767464de8d063366117f508359e5ca40a50 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 25 Mar 2020 12:16:41 -0300 -Subject: [PATCH 3/9] Fix clang's behavior on versions >= 7 +Subject: [PATCH 3/3] Fix clang's behavior on versions >= 7 Clang 7 changed the behavior of vec_xxpermdi in order to match GCC's behavior. After this change, code that used to work on Clang 6 stopped @@ -2855,1509 +2861,5 @@ index b5e7dae..915f7e5 100644 } #endif /* vec_xxpermdi */ -- -2.34.3 - - -From 772f4bd0f880c4c193ab7da78728f38821572a02 Mon Sep 17 00:00:00 2001 -From: Rogerio Alves -Date: Mon, 9 Dec 2019 14:40:53 -0300 -Subject: [PATCH 4/9] Adler32 vector optimization for Power. - -This commit implements a Power (POWER8+) vector optimization for Adler32 -checksum using VSX (vector) instructions. The VSX adler32 checksum is up -to 10x fast than the adler32 baseline code. - -Author: Rogerio Alves ---- - CMakeLists.txt | 1 + - Makefile.in | 8 ++ - adler32.c | 11 ++ - configure | 4 +- - contrib/power/adler32_power8.c | 196 +++++++++++++++++++++++++++++++ - contrib/power/adler32_resolver.c | 15 +++ - contrib/power/power.h | 4 +- - 7 files changed, 236 insertions(+), 3 deletions(-) - create mode 100644 contrib/power/adler32_power8.c - create mode 100644 contrib/power/adler32_resolver.c - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 581e1fa..c6296ee 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -185,6 +185,7 @@ if(CMAKE_COMPILER_IS_GNUCC) - if(POWER8) - add_definitions(-DZ_POWER8) - set(ZLIB_POWER8 -+ contrib/power/adler32_power8.c - contrib/power/crc32_z_power8.c) - - set_source_files_properties( -diff --git a/Makefile.in b/Makefile.in -index 1694304..a0ffac8 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -165,6 +165,9 @@ minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h - adler32.o: $(SRCDIR)adler32.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c - -+adler32_power8.o: $(SRCDIR)contrib/power/adler32_power8.c -+ $(CC) $(CFLAGS) -mcpu=power8 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/adler32_power8.c -+ - crc32.o: $(SRCDIR)crc32.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c - -@@ -216,6 +219,11 @@ adler32.lo: $(SRCDIR)adler32.c - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c - -@mv objs/adler32.o $@ - -+adler32_power8.lo: $(SRCDIR)contrib/power/adler32_power8.c -+ -@mkdir objs 2>/dev/null || test -d objs -+ $(CC) $(SFLAGS) -mcpu=power8 $(ZINC) -DPIC -c -o objs/adler32_power8.o $(SRCDIR)contrib/power/adler32_power8.c -+ -@mv objs/adler32_power8.o $@ -+ - crc32.lo: $(SRCDIR)crc32.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c -diff --git a/adler32.c b/adler32.c -index d0be438..4bde0fa 100644 ---- a/adler32.c -+++ b/adler32.c -@@ -131,6 +131,12 @@ uLong ZEXPORT adler32_z(adler, buf, len) - } - - /* ========================================================================= */ -+ -+#ifdef Z_POWER_OPT -+/* Rename the default function to avoid naming conflicts */ -+#define adler32 adler32_default -+#endif /* Z_POWER_OPT */ -+ - uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; -@@ -139,6 +145,11 @@ uLong ZEXPORT adler32(adler, buf, len) - return adler32_z(adler, buf, len); - } - -+#ifdef Z_POWER_OPT -+#undef adler32 -+#include "contrib/power/adler32_resolver.c" -+#endif /* Z_POWER_OPT */ -+ - /* ========================================================================= */ - local uLong adler32_combine_(adler1, adler2, len2) - uLong adler1; -diff --git a/configure b/configure -index 914d9f4..810a740 100755 ---- a/configure -+++ b/configure -@@ -879,8 +879,8 @@ if tryboth $CC -c $CFLAGS $test.c; then - - if tryboth $CC -c $CFLAGS -mcpu=power8 $test.c; then - POWER8="-DZ_POWER8" -- PIC_OBJC="${PIC_OBJC} crc32_z_power8.lo" -- OBJC="${OBJC} crc32_z_power8.o" -+ PIC_OBJC="${PIC_OBJC} adler32_power8.lo crc32_z_power8.lo" -+ OBJC="${OBJC} adler32_power8.o crc32_z_power8.o" - echo "Checking for -mcpu=power8 support... Yes." | tee -a configure.log - else - echo "Checking for -mcpu=power8 support... No." | tee -a configure.log -diff --git a/contrib/power/adler32_power8.c b/contrib/power/adler32_power8.c -new file mode 100644 -index 0000000..473c394 ---- /dev/null -+++ b/contrib/power/adler32_power8.c -@@ -0,0 +1,196 @@ -+/* -+ * Adler32 for POWER 8+ using VSX instructions. -+ * -+ * Calculate adler32 checksum for 16 bytes at once using POWER8+ VSX (vector) -+ * instructions. -+ * -+ * If adler32 do 1 byte at time on the first iteration s1 is s1_0 (_n means -+ * iteration n) is the initial value of adler - at start _0 is 1 unless -+ * adler initial value is different than 1. So s1_1 = s1_0 + c[0] after -+ * the first calculation. For the iteration s1_2 = s1_1 + c[1] and so on. -+ * Hence, for iteration N, s1_N = s1_(N-1) + c[N] is the value of s1 on -+ * after iteration N. -+ * -+ * Therefore, for s2 and iteration N, s2_N = s2_0 + N*s1_N + N*c[0] + -+ * N-1*c[1] + ... + c[N] -+ * -+ * In a more general way: -+ * -+ * s1_N = s1_0 + sum(i=1 to N)c[i] -+ * s2_N = s2_0 + N*s1 + sum (i=1 to N)(N-i+1)*c[i] -+ * -+ * Where s1_N, s2_N are the values for s1, s2 after N iterations. So if we -+ * can process N-bit at time we can do this at once. -+ * -+ * Since VSX can support 16-bit vector instructions, we can process -+ * 16-bit at time using N = 16 we have: -+ * -+ * s1 = s1_16 = s1_(16-1) + c[16] = s1_0 + sum(i=1 to 16)c[i] -+ * s2 = s2_16 = s2_0 + 16*s1 + sum(i=1 to 16)(16-i+1)*c[i] -+ * -+ * After the first iteration we calculate the adler32 checksum for 16 bytes. -+ * -+ * For more background about adler32 please check the RFC: -+ * https://www.ietf.org/rfc/rfc1950.txt -+ * -+ * Copyright (C) 2019 Rogerio Alves , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ * -+ */ -+ -+#include "../../zutil.h" -+#include -+ -+/* Largest prime smaller than 65536. */ -+#define BASE 65521U -+#define NMAX 5552 -+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1. */ -+ -+#define DO1(s1,s2,buf,i) {(s1) += buf[(i)]; (s2) += (s1);} -+#define DO2(s1,s2,buf,i) {DO1(s1,s2,buf,i); DO1(s1,s2,buf,i+1);} -+#define DO4(s1,s2,buf,i) {DO2(s1,s2,buf,i); DO2(s1,s2,buf,i+2);} -+#define DO8(s1,s2,buf,i) {DO4(s1,s2,buf,i); DO4(s1,s2,buf,i+4);} -+#define DO16(s1,s2,buf) {DO8(s1,s2,buf,0); DO8(s1,s2,buf,8);} -+ -+/* Vector across sum unsigned int (saturate). */ -+inline vector unsigned int vec_sumsu (vector unsigned int __a, -+ vector unsigned int __b) -+{ -+ __b = vec_sld(__a, __a, 8); -+ __b = vec_add(__b, __a); -+ __a = vec_sld(__b, __b, 4); -+ __a = vec_add(__a, __b); -+ -+ return __a; -+} -+ -+uLong ZLIB_INTERNAL _adler32_power8 (uLong adler, const Bytef* buf, uInt len) -+{ -+ /* If buffer is empty or len=0 we need to return adler initial value. */ -+ if (buf == NULL) -+ return 1; -+ -+ unsigned int s1 = adler & 0xffff; -+ unsigned int s2 = (adler >> 16) & 0xffff; -+ -+ /* in case user likes doing a byte at a time, keep it fast */ -+ if (len == 1) { -+ s1 += buf[0]; -+ if (s1 >= BASE) -+ s1 -= BASE; -+ s2 += s1; -+ if (s2 >= BASE) -+ s2 -= BASE; -+ return (s2 << 16) | s1; -+ } -+ -+ /* Keep it fast for short length buffers. */ -+ if (len < 16) { -+ while (len--) { -+ s1 += *buf++; -+ s2 += s1; -+ } -+ if (s1 >= BASE) -+ s1 -= BASE; -+ s2 %= BASE; -+ return (s2 << 16) | s1; -+ } -+ -+ /* This is faster than VSX code for len < 64. */ -+ if (len < 64) { -+ while (len >= 16) { -+ len -= 16; -+ DO16(s1,s2,buf); -+ buf += 16; -+ } -+ } else { -+ /* Use POWER VSX instructions for len >= 64. */ -+ const vector unsigned int v_zeros = { 0 }; -+ const vector unsigned char v_mul = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, -+ 6, 5, 4, 3, 2, 1}; -+ const vector unsigned char vsh = vec_splat_u8(4); -+ const vector unsigned int vmask = {0xffffffff, 0x0, 0x0, 0x0}; -+ vector unsigned int vs1 = vec_xl(0, &s1); -+ vector unsigned int vs2 = vec_xl(0, &s2); -+ vector unsigned int vs1_save = { 0 }; -+ vector unsigned int vsum1, vsum2; -+ vector unsigned char vbuf; -+ int n; -+ -+ /* Zeros the undefined values of vectors vs1, vs2. */ -+ vs1 = vec_and(vs1, vmask); -+ vs2 = vec_and(vs2, vmask); -+ -+ /* Do length bigger than NMAX in blocks of NMAX size. */ -+ while (len >= NMAX) { -+ len -= NMAX; -+ n = NMAX / 16; -+ do { -+ vbuf = vec_xl(0, (unsigned char *) buf); -+ vsum1 = vec_sum4s(vbuf, v_zeros); /* sum(i=1 to 16) buf[i]. */ -+ /* sum(i=1 to 16) buf[i]*(16-i+1). */ -+ vsum2 = vec_msum(vbuf, v_mul, v_zeros); -+ /* Save vs1. */ -+ vs1_save = vec_add(vs1_save, vs1); -+ /* Accumulate the sums. */ -+ vs1 = vec_add(vsum1, vs1); -+ vs2 = vec_add(vsum2, vs2); -+ -+ buf += 16; -+ } while (--n); -+ /* Once each block of NMAX size. */ -+ vs1 = vec_sumsu(vs1, vsum1); -+ vs1_save = vec_sll(vs1_save, vsh); /* 16*vs1_save. */ -+ vs2 = vec_add(vs1_save, vs2); -+ vs2 = vec_sumsu(vs2, vsum2); -+ -+ /* vs1[0] = (s1_i + sum(i=1 to 16)buf[i]) mod 65521. */ -+ vs1[0] = vs1[0] % BASE; -+ /* vs2[0] = s2_i + 16*s1_save + -+ sum(i=1 to 16)(16-i+1)*buf[i] mod 65521. */ -+ vs2[0] = vs2[0] % BASE; -+ -+ vs1 = vec_and(vs1, vmask); -+ vs2 = vec_and(vs2, vmask); -+ vs1_save = v_zeros; -+ } -+ -+ /* len is less than NMAX one modulo is needed. */ -+ if (len >= 16) { -+ while (len >= 16) { -+ len -= 16; -+ -+ vbuf = vec_xl(0, (unsigned char *) buf); -+ -+ vsum1 = vec_sum4s(vbuf, v_zeros); /* sum(i=1 to 16) buf[i]. */ -+ /* sum(i=1 to 16) buf[i]*(16-i+1). */ -+ vsum2 = vec_msum(vbuf, v_mul, v_zeros); -+ /* Save vs1. */ -+ vs1_save = vec_add(vs1_save, vs1); -+ /* Accumulate the sums. */ -+ vs1 = vec_add(vsum1, vs1); -+ vs2 = vec_add(vsum2, vs2); -+ -+ buf += 16; -+ } -+ /* Since the size will be always less than NMAX we do this once. */ -+ vs1 = vec_sumsu(vs1, vsum1); -+ vs1_save = vec_sll(vs1_save, vsh); /* 16*vs1_save. */ -+ vs2 = vec_add(vs1_save, vs2); -+ vs2 = vec_sumsu(vs2, vsum2); -+ } -+ /* Copy result back to s1, s2 (mod 65521). */ -+ s1 = vs1[0] % BASE; -+ s2 = vs2[0] % BASE; -+ } -+ -+ /* Process tail (len < 16). */ -+ while (len--) { -+ s1 += *buf++; -+ s2 += s1; -+ } -+ s1 %= BASE; -+ s2 %= BASE; -+ -+ return (s2 << 16) | s1; -+} -diff --git a/contrib/power/adler32_resolver.c b/contrib/power/adler32_resolver.c -new file mode 100644 -index 0000000..07a1a2c ---- /dev/null -+++ b/contrib/power/adler32_resolver.c -@@ -0,0 +1,15 @@ -+/* Copyright (C) 2019 Rogerio Alves , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ */ -+ -+#include "../gcc/zifunc.h" -+#include "power.h" -+ -+Z_IFUNC(adler32) { -+#ifdef Z_POWER8 -+ if (__builtin_cpu_supports("arch_2_07")) -+ return _adler32_power8; -+#endif -+ -+ return adler32_default; -+} -diff --git a/contrib/power/power.h b/contrib/power/power.h -index 79123aa..f57c761 100644 ---- a/contrib/power/power.h -+++ b/contrib/power/power.h -@@ -2,7 +2,9 @@ - * 2019 Rogerio Alves , IBM - * For conditions of distribution and use, see copyright notice in zlib.h - */ -- - #include "../../zconf.h" -+#include "../../zutil.h" -+ -+uLong _adler32_power8(uLong adler, const Bytef* buf, uInt len); - - unsigned long _crc32_z_power8(unsigned long, const Bytef *, z_size_t); --- -2.34.3 - - -From f5de1ed4288561443323ba41de68d65b31bc3a19 Mon Sep 17 00:00:00 2001 -From: Rogerio Alves -Date: Tue, 10 Dec 2019 15:04:28 -0300 -Subject: [PATCH 5/9] Tests for Adler32 vector optimization for Power. - -This commit add tests for adler32 vector optimization for Power (POWER8+). - -Author: Rogerio Alves ---- - CMakeLists.txt | 10 ++ - Makefile.in | 36 +++-- - test/adler32_test.c | 339 ++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 378 insertions(+), 10 deletions(-) - create mode 100644 test/adler32_test.c - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c6296ee..44de486 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -299,6 +299,10 @@ endif() - # Example binaries - #============================================================================ - -+add_executable(adler32_test test/adler32_test.c) -+target_link_libraries(adler32_test zlib) -+add_test(adler32_test adler32_test) -+ - add_executable(example test/example.c) - target_link_libraries(example zlib) - add_test(example example) -@@ -311,6 +315,12 @@ add_executable(minigzip test/minigzip.c) - target_link_libraries(minigzip zlib) - - if(HAVE_OFF64_T) -+ -+ add_executable(adler32_test64 test/adler32_test.c) -+ target_link_libraries(adler32_test64 zlib) -+ set_target_properties(adler32_test64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -+ add_test(adler32_test64 adler32_test64) -+ - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -diff --git a/Makefile.in b/Makefile.in -index a0ffac8..9ef9fa9 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -75,11 +75,11 @@ PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) - - all: static shared - --static: crc32_test$(EXE) example$(EXE) minigzip$(EXE) -+static: adler32_test$(EXE) crc32_test$(EXE) example$(EXE) minigzip$(EXE) - --shared: crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) -+shared: adler32_testsh$(EXE) crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) - --all64: crc32_test64$(EXE) example64$(EXE) minigzip64$(EXE) -+all64: adler32_test64$(EXE) crc32_test64$(EXE) example64$(EXE) minigzip64$(EXE) - - check: test - -@@ -87,7 +87,7 @@ test: all teststatic testshared - - teststatic: static - @TMPST=tmpst_$$; \ -- if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST && ./crc32_test; then \ -+ if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST && ./adler32_test && ./crc32_test; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; false; \ -@@ -100,7 +100,7 @@ testshared: shared - DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ - SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ - TMPSH=tmpsh_$$; \ -- if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH && ./crc32_testsh; then \ -+ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH && ./adler32_testsh && ./crc32_testsh; then \ - echo ' *** zlib shared test OK ***'; \ - else \ - echo ' *** zlib shared test FAILED ***'; false; \ -@@ -109,7 +109,7 @@ testshared: shared - - test64: all64 - @TMP64=tmp64_$$; \ -- if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64 && ./crc32_test64; then \ -+ if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64 && ./adler32_test64 && ./crc32_test64; then \ - echo ' *** zlib 64-bit test OK ***'; \ - else \ - echo ' *** zlib 64-bit test FAILED ***'; false; \ -@@ -143,6 +143,9 @@ match.lo: match.S - mv _match.o match.lo - rm -f _match.s - -+adler32_test.o: $(SRCDIR)test/adler32_test.c $(SRCDIR)zlib.h zconf.h -+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/adler32_test.c -+ - crc32_test.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/crc32_test.c - -@@ -152,6 +155,9 @@ example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h - minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c - -+adler32_test64.o: $(SRCDIR)test/adler32_test.c $(SRCDIR)zlib.h zconf.h -+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/adler32_test.c -+ - crc32_test64.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/crc32_test.c - -@@ -307,6 +313,9 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a - ln -s $@ $(SHAREDLIBM) - -@rmdir objs - -+adler32_test$(EXE): adler32_test.o $(STATICLIB) -+ $(CC) $(CFLAGS) -o $@ adler32_test.o $(TEST_LDFLAGS) -+ - crc32_test$(EXE): crc32_test.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ crc32_test.o $(TEST_LDFLAGS) - -@@ -316,6 +325,9 @@ example$(EXE): example.o $(STATICLIB) - minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) - -+adler32_testsh$(EXE): adler32_test.o $(SHAREDLIBV) -+ $(CC) $(CFLAGS) -o $@ adler32_test.o -L. $(SHAREDLIBV) -+ - crc32_testsh$(EXE): crc32_test.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ crc32_test.o -L. $(SHAREDLIBV) - -@@ -325,6 +337,9 @@ examplesh$(EXE): example.o $(SHAREDLIBV) - minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) - -+adler32_test64$(EXE): adler32_test64.o $(STATICLIB) -+ $(CC) $(CFLAGS) -o $@ adler32_test64.o $(TEST_LDFLAGS) -+ - crc32_test64$(EXE): crc32_test64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ crc32_test64.o $(TEST_LDFLAGS) - -@@ -397,8 +412,9 @@ zconf: $(SRCDIR)zconf.h.in - mostlyclean: clean - clean: - rm -f *.o *.lo *~ \ -- crc32_test$(EXE) example$(EXE) minigzip$(EXE) crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ -- crc32_test64$(EXE) example64$(EXE) minigzip64$(EXE) \ -+ adler32_test$(EXE) crc32_test$(EXE) example$(EXE) minigzip$(EXE) \ -+ adler32_testsh$(EXE) crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ -+ adler32_test64$(EXE) crc32_test64$(EXE) example64$(EXE) minigzip64$(EXE) \ - infcover \ - libz.* foo.gz so_locations \ - _match.s maketree contrib/infback9/*.o -@@ -418,7 +434,7 @@ distclean: clean zconf zconf.h.cmakein - tags: - etags $(SRCDIR)*.[ch] - --adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h -+adler32.o adler32_test.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h - gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h - compress.o crc32_test.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h - crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h -@@ -428,7 +444,7 @@ inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR - inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h - trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h - --adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h -+adler32.lo adler32_test.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h - gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h - compress.lo crc32_test.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h - crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h -diff --git a/test/adler32_test.c b/test/adler32_test.c -new file mode 100644 -index 0000000..6cf3e2b ---- /dev/null -+++ b/test/adler32_test.c -@@ -0,0 +1,339 @@ -+/* adler32_test.c -- unit test for adler32 in the zlib compression library -+ * Copyright (C) 2019 Rogerio Alves , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ */ -+ -+#include "zlib.h" -+#include -+ -+#ifdef STDC -+# include -+# include -+#endif -+ -+void test_adler32 OF((uLong adler, Byte* buf, z_size_t len, uLong chk, int line)); -+int main OF((void)); -+ -+typedef struct { -+ int line; -+ uLong adler; -+ Byte* buf; -+ int len; -+ uLong expect; -+} adler32_test; -+ -+void test_adler32(adler, buf, len, chk, line) -+ uLong adler; -+ Byte *buf; -+ z_size_t len; -+ uLong chk; -+ int line; -+{ -+ uLong res = adler32(adler, buf, len); -+ if (res != chk) { -+ fprintf(stderr, "FAIL [%d]: adler32 returned 0x%08X expected 0x%08X\n", -+ line, (unsigned int)res, (unsigned int)chk); -+ exit(1); -+ } -+} -+ -+static const adler32_test tests[] = { -+ {__LINE__,0x1, 0x0, 0, 0x1}, -+ {__LINE__,0x1, "", 1, 0x10001}, -+ {__LINE__,0x1, "a", 1, 0x620062}, -+ {__LINE__,0x1, "abacus", 6, 0x8400270}, -+ {__LINE__,0x1, "backlog", 7, 0xb1f02d4}, -+ {__LINE__,0x1, "campfire", 8, 0xea10348}, -+ {__LINE__,0x1, "delta", 5, 0x61a020b}, -+ {__LINE__,0x1, "executable", 10, 0x16fa0423}, -+ {__LINE__,0x1, "file", 4, 0x41401a1}, -+ {__LINE__,0x1, "greatest", 8, 0xefa0360}, -+ {__LINE__,0x1, "inverter", 8, 0xf6f0370}, -+ {__LINE__,0x1, "jigsaw", 6, 0x8bd0286}, -+ {__LINE__,0x1, "karate", 6, 0x8a50279}, -+ {__LINE__,0x1, "landscape", 9, 0x126a03ac}, -+ {__LINE__,0x1, "machine", 7, 0xb5302d6}, -+ {__LINE__,0x1, "nanometer", 9, 0x12d803ca}, -+ {__LINE__,0x1, "oblivion", 8, 0xf220363}, -+ {__LINE__,0x1, "panama", 6, 0x8a1026f}, -+ {__LINE__,0x1, "quest", 5, 0x6970233}, -+ {__LINE__,0x1, "resource", 8, 0xf8d0369}, -+ {__LINE__,0x1, "secret", 6, 0x8d10287}, -+ {__LINE__,0x1, "ultimate", 8, 0xf8d0366}, -+ {__LINE__,0x1, "vector", 6, 0x8fb0294}, -+ {__LINE__,0x1, "walrus", 6, 0x918029f}, -+ {__LINE__,0x1, "xeno", 4, 0x45e01bb}, -+ {__LINE__,0x1, "yelling", 7, 0xbfe02f5}, -+ {__LINE__,0x1, "zero", 4, 0x46e01c1}, -+ {__LINE__,0x1, "4BJD7PocN1VqX0jXVpWB", 20, 0x3eef064d}, -+ {__LINE__,0x1, "F1rPWI7XvDs6nAIRx41l", 20, 0x425d065f}, -+ {__LINE__,0x1, "ldhKlsVkPFOveXgkGtC2", 20, 0x4f1a073e}, -+ {__LINE__,0x1, "5KKnGOOrs8BvJ35iKTOS", 20, 0x42290650}, -+ {__LINE__,0x1, "0l1tw7GOcem06Ddu7yn4", 20, 0x43fd0690}, -+ {__LINE__,0x1, "MCr47CjPIn9R1IvE1Tm5", 20, 0x3f770609}, -+ {__LINE__,0x1, "UcixbzPKTIv0SvILHVdO", 20, 0x4c7c0703}, -+ {__LINE__,0x1, "dGnAyAhRQDsWw0ESou24", 20, 0x48ac06b7}, -+ {__LINE__,0x1, "di0nvmY9UYMYDh0r45XT", 20, 0x489a0698}, -+ {__LINE__,0x1, "2XKDwHfAhFsV0RhbqtvH", 20, 0x44a906e6}, -+ {__LINE__,0x1, "ZhrANFIiIvRnqClIVyeD", 20, 0x4a29071c}, -+ {__LINE__,0x1, "v7Q9ehzioTOVeDIZioT1", 20, 0x4a7706f9}, -+ {__LINE__,0x1, "Yod5hEeKcYqyhfXbhxj2", 20, 0x4ce60769}, -+ {__LINE__,0x1, "GehSWY2ay4uUKhehXYb0", 20, 0x48ae06e5}, -+ {__LINE__,0x1, "kwytJmq6UqpflV8Y8GoE", 20, 0x51d60750}, -+ {__LINE__,0x1, "70684206568419061514", 20, 0x2b100414}, -+ {__LINE__,0x1, "42015093765128581010", 20, 0x2a550405}, -+ {__LINE__,0x1, "88214814356148806939", 20, 0x2b450423}, -+ {__LINE__,0x1, "43472694284527343838", 20, 0x2b460421}, -+ {__LINE__,0x1, "49769333513942933689", 20, 0x2bc1042b}, -+ {__LINE__,0x1, "54979784887993251199", 20, 0x2ccd043d}, -+ {__LINE__,0x1, "58360544869206793220", 20, 0x2b68041a}, -+ {__LINE__,0x1, "27347953487840714234", 20, 0x2b84041d}, -+ {__LINE__,0x1, "07650690295365319082", 20, 0x2afa0417}, -+ {__LINE__,0x1, "42655507906821911703", 20, 0x2aff0412}, -+ {__LINE__,0x1, "29977409200786225655", 20, 0x2b8d0420}, -+ {__LINE__,0x1, "85181542907229116674", 20, 0x2b140419}, -+ {__LINE__,0x1, "87963594337989416799", 20, 0x2c8e043f}, -+ {__LINE__,0x1, "21395988329504168551", 20, 0x2b68041f}, -+ {__LINE__,0x1, "51991013580943379423", 20, 0x2af10417}, -+ {__LINE__,0x1, "*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x7c9d0841}, -+ {__LINE__,0x1, "_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0x71060751}, -+ {__LINE__,0x1, "&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0x7095070a}, -+ {__LINE__,0x1, "]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0x82530815}, -+ {__LINE__,0x1, "-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0x61250661}, -+ {__LINE__,0x1, "+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x642006a3}, -+ {__LINE__,0x1, ")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0x674206cb}, -+ {__LINE__,0x1, ":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x67670680}, -+ {__LINE__,0x1, "{[#-;:$/{)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 0x8b81718f}, -+ {__LINE__,0x7a30360d, 0x0, 0, 0x1}, -+ {__LINE__,0x6fd767ee, "", 1, 0xd7c567ee}, -+ {__LINE__,0xefeb7589, "a", 1, 0x65e475ea}, -+ {__LINE__,0x61cf7e6b, "abacus", 6, 0x60b880da}, -+ {__LINE__,0xdc712e2, "backlog", 7, 0x9d0d15b5}, -+ {__LINE__,0xad23c7fd, "campfire", 8, 0xfbfecb44}, -+ {__LINE__,0x85cb2317, "delta", 5, 0x3b622521}, -+ {__LINE__,0x9eed31b0, "executable", 10, 0xa6db35d2}, -+ {__LINE__,0xb94f34ca, "file", 4, 0x9096366a}, -+ {__LINE__,0xab058a2, "greatest", 8, 0xded05c01}, -+ {__LINE__,0x5bff2b7a, "inverter", 8, 0xc7452ee9}, -+ {__LINE__,0x605c9a5f, "jigsaw", 6, 0x7899ce4}, -+ {__LINE__,0x51bdeea5, "karate", 6, 0xf285f11d}, -+ {__LINE__,0x85c21c79, "landscape", 9, 0x98732024}, -+ {__LINE__,0x97216f56, "machine", 7, 0xadf4722b}, -+ {__LINE__,0x18444af2, "nanometer", 9, 0xcdb34ebb}, -+ {__LINE__,0xbe6ce359, "oblivion", 8, 0xe8b7e6bb}, -+ {__LINE__,0x843071f1, "panama", 6, 0x389e745f}, -+ {__LINE__,0xf2480c60, "quest", 5, 0x36c90e92}, -+ {__LINE__,0x2d2feb3d, "resource", 8, 0x9705eea5}, -+ {__LINE__,0x7490310a, "secret", 6, 0xa3a63390}, -+ {__LINE__,0x97d247d4, "ultimate", 8, 0xe6154b39}, -+ {__LINE__,0x93cf7599, "vector", 6, 0x5e87782c}, -+ {__LINE__,0x73c84278, "walrus", 6, 0xbc84516}, -+ {__LINE__,0x228a87d1, "xeno", 4, 0x4646898b}, -+ {__LINE__,0xa7a048d0, "yelling", 7, 0xb1654bc4}, -+ {__LINE__,0x1f0ded40, "zero", 4, 0xd8a4ef00}, -+ {__LINE__,0xa804a62f, "4BJD7PocN1VqX0jXVpWB", 20, 0xe34eac7b}, -+ {__LINE__,0x508fae6a, "F1rPWI7XvDs6nAIRx41l", 20, 0x33f2b4c8}, -+ {__LINE__,0xe5adaf4f, "ldhKlsVkPFOveXgkGtC2", 20, 0xe7b1b68c}, -+ {__LINE__,0x67136a40, "5KKnGOOrs8BvJ35iKTOS", 20, 0xf6a0708f}, -+ {__LINE__,0xb00c4a10, "0l1tw7GOcem06Ddu7yn4", 20, 0xbd8f509f}, -+ {__LINE__,0x2e0c84b5, "MCr47CjPIn9R1IvE1Tm5", 20, 0xcc298abd}, -+ {__LINE__,0x81238d44, "UcixbzPKTIv0SvILHVdO", 20, 0xd7809446}, -+ {__LINE__,0xf853aa92, "dGnAyAhRQDsWw0ESou24", 20, 0x9525b148}, -+ {__LINE__,0x5a692325, "di0nvmY9UYMYDh0r45XT", 20, 0x620029bc}, -+ {__LINE__,0x3275b9f, "2XKDwHfAhFsV0RhbqtvH", 20, 0x70916284}, -+ {__LINE__,0x38371feb, "ZhrANFIiIvRnqClIVyeD", 20, 0xd52706}, -+ {__LINE__,0xafc8bf62, "v7Q9ehzioTOVeDIZioT1", 20, 0xeeb4c65a}, -+ {__LINE__,0x9b07db73, "Yod5hEeKcYqyhfXbhxj2", 20, 0xde3e2db}, -+ {__LINE__,0xe75b214, "GehSWY2ay4uUKhehXYb0", 20, 0x4171b8f8}, -+ {__LINE__,0x72d0fe6f, "kwytJmq6UqpflV8Y8GoE", 20, 0xa66a05cd}, -+ {__LINE__,0xf857a4b1, "70684206568419061514", 20, 0x1f9a8c4}, -+ {__LINE__,0x54b8e14, "42015093765128581010", 20, 0x49c19218}, -+ {__LINE__,0xd6aa5616, "88214814356148806939", 20, 0xbbfc5a38}, -+ {__LINE__,0x11e63098, "43472694284527343838", 20, 0x93434b8}, -+ {__LINE__,0xbe92385, "49769333513942933689", 20, 0xfe1827af}, -+ {__LINE__,0x49511de0, "54979784887993251199", 20, 0xcba8221c}, -+ {__LINE__,0x3db13bc1, "58360544869206793220", 20, 0x14643fda}, -+ {__LINE__,0xbb899bea, "27347953487840714234", 20, 0x1604a006}, -+ {__LINE__,0xf6cd9436, "07650690295365319082", 20, 0xb69f984c}, -+ {__LINE__,0x9109e6c3, "42655507906821911703", 20, 0xc43eead4}, -+ {__LINE__,0x75770fc, "29977409200786225655", 20, 0x707751b}, -+ {__LINE__,0x69b1d19b, "85181542907229116674", 20, 0xf5bdd5b3}, -+ {__LINE__,0xc6132975, "87963594337989416799", 20, 0x2fed2db3}, -+ {__LINE__,0xd58cb00c, "21395988329504168551", 20, 0xc2a2b42a}, -+ {__LINE__,0xb63b8caa, "51991013580943379423", 20, 0xdf0590c0}, -+ {__LINE__,0x8a45a2b8, "*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x1980aaf8}, -+ {__LINE__,0xcbe95b78, "_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0xf58662c8}, -+ {__LINE__,0x4ef8a54b, "&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0x1f65ac54}, -+ {__LINE__,0x76ad267a, "]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0x7b792e8e}, -+ {__LINE__,0x569e613c, "-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0x1d61679c}, -+ {__LINE__,0x36aa61da, "+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x12ec687c}, -+ {__LINE__,0xf67222df, ")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0x740329a9}, -+ {__LINE__,0x74b34fd3, ":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x374c5652}, -+ {__LINE__,0x351fd770, "{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0xeadfde7e}, -+ {__LINE__,0xc45aef77, "_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0x3fcbf664}, -+ {__LINE__,0xd034ea71, "e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+f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QPnGiA" -+ "8cQzBaV42B2zuu3iLwygKHky2Bbe5e4eU4znPzacEfuMGCgzj4E7RtDKctpgWHCHJQJcF54WK7jhA" -+ "TKztSffjCc8n7cTURQE7AWZzK5j2HkajggWw4TA9JUeSNPKdkLQGZeWiHujCz4E2v5Lu9Za9AbCMG" -+ "XBC2YZeUnE5YnyFhHp9jYFVwYr8QfCJ4TtzQNMe743yEMmbSchwaXEdEzth9kpAkKHxqKZBua93UU" -+ "u8EDvykWYXkrRDXnQVdeDgxEVYwkmKrHDt26NUg3tB9tuMDzYKzKrV5iepMdtw6affWkLigMVMYbx" -+ "e4hhYgwZmee6RWMxGyVn6egAgKaN7pauE46MtXhgbjp5xxBP3JM7jZPyeQZetj3tFVxmbbByJLL93" -+ "Ra5jSVte26mHwrwr6Q3xzmAdxtEHcZxcPjruUWk6gXgnfn7HMBtv6vxgMfe2wmydHSqcKUH2XhdpQ" -+ "7JXiXfazVAF28zvhChe4gzwzhqp6Bnm8hWU7zhT6Jf4ZnQWz2N4tg7u4X2CFLnJnmj3P3YeJRAHeR" -+ "Dz7uXYyDwJmGUPH5SdaFFYcMf33LvVBUCAdNHQh784rpGvMDH7eEriKQiBDMZpcRGucHaNkEf9R7x" -+ "635ux3hvp6qrjufWTqPnYLB6UwP2TWRg233eNVajbe4TuJuuFBDGHxxk5Ge34BmLSbitTpMDZAAir" -+ "Jp4HUAGydQ5URF8qaSHn5z9g3uRHmGmbpcLZYumiKAQRTXGtb8776wMNfRGrLmqn75kX8guK7YwKq" -+ "UeWAriZapqL5PuntyGxCNXqPrUvArrqefczM7N6azZatfp4vJYjhMDtkABpQAyxX7pS8mMyKBA527" -+ "byRKqAu3J", 5552, 0x7dc51be2}, -+}; -+ -+static const int test_size = sizeof(tests) / sizeof(tests[0]); -+ -+int main(void) -+{ -+ int i; -+ for (i = 0; i < test_size; i++) { -+ test_adler32(tests[i].adler, tests[i].buf, tests[i].len, -+ tests[i].expect, tests[i].line); -+ } -+ return 0; -+} --- -2.34.3 - - -From f06e8c232a94d75f26c993cc879c914c066d3fd5 Mon Sep 17 00:00:00 2001 -From: Matheus Castanho -Date: Mon, 9 Mar 2020 16:30:11 -0300 -Subject: [PATCH 6/9] adler32_test: Fix warning when compiling with -Wall - ---- - test/adler32_test.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/adler32_test.c b/test/adler32_test.c -index 6cf3e2b..8042295 100644 ---- a/test/adler32_test.c -+++ b/test/adler32_test.c -@@ -17,7 +17,7 @@ int main OF((void)); - typedef struct { - int line; - uLong adler; -- Byte* buf; -+ char* buf; - int len; - uLong expect; - } adler32_test; -@@ -332,7 +332,7 @@ int main(void) - { - int i; - for (i = 0; i < test_size; i++) { -- test_adler32(tests[i].adler, tests[i].buf, tests[i].len, -+ test_adler32(tests[i].adler, (Byte*) tests[i].buf, tests[i].len, - tests[i].expect, tests[i].line); - } - return 0; --- -2.34.3 - - -From 11b722e4ae91b611f605221587ec8e0829c27949 Mon Sep 17 00:00:00 2001 -From: Matheus Castanho -Date: Tue, 23 Jun 2020 10:26:19 -0300 -Subject: [PATCH 7/9] Fix invalid memory access on ppc and ppc64 - ---- - contrib/power/adler32_power8.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/contrib/power/adler32_power8.c b/contrib/power/adler32_power8.c -index 473c394..fdd0864 100644 ---- a/contrib/power/adler32_power8.c -+++ b/contrib/power/adler32_power8.c -@@ -110,16 +110,15 @@ uLong ZLIB_INTERNAL _adler32_power8 (uLong adler, const Bytef* buf, uInt len) - 6, 5, 4, 3, 2, 1}; - const vector unsigned char vsh = vec_splat_u8(4); - const vector unsigned int vmask = {0xffffffff, 0x0, 0x0, 0x0}; -- vector unsigned int vs1 = vec_xl(0, &s1); -- vector unsigned int vs2 = vec_xl(0, &s2); -+ vector unsigned int vs1 = { 0 }; -+ vector unsigned int vs2 = { 0 }; - vector unsigned int vs1_save = { 0 }; - vector unsigned int vsum1, vsum2; - vector unsigned char vbuf; - int n; - -- /* Zeros the undefined values of vectors vs1, vs2. */ -- vs1 = vec_and(vs1, vmask); -- vs2 = vec_and(vs2, vmask); -+ vs1[0] = s1; -+ vs2[0] = s2; - - /* Do length bigger than NMAX in blocks of NMAX size. */ - while (len >= NMAX) { --- -2.34.3 - - -From 4a8d89ae49aa17d1634a2816c8d159f533a07eae Mon Sep 17 00:00:00 2001 -From: Matheus Castanho -Date: Wed, 27 Nov 2019 10:18:10 -0300 -Subject: [PATCH 8/9] Add optimized slide_hash for Power - -Considerable time is spent on deflate.c:slide_hash() during -deflate. This commit introduces a new slide_hash function that -uses VSX vector instructions to slide 8 hash elements at a time, -instead of just one as the standard code does. - -The choice between the optimized and default versions is made only -on the first call to the function, enabling a fallback to standard -behavior if the host processor does not support VSX instructions, -so the same binary can be used for multiple Power processor -versions. - -Author: Matheus Castanho ---- - CMakeLists.txt | 3 +- - Makefile.in | 8 ++++ - configure | 4 +- - contrib/power/power.h | 3 ++ - contrib/power/slide_hash_power8.c | 63 +++++++++++++++++++++++++++++ - contrib/power/slide_hash_resolver.c | 15 +++++++ - deflate.c | 12 ++++++ - 7 files changed, 105 insertions(+), 3 deletions(-) - create mode 100644 contrib/power/slide_hash_power8.c - create mode 100644 contrib/power/slide_hash_resolver.c - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 44de486..8208c62 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -186,7 +186,8 @@ if(CMAKE_COMPILER_IS_GNUCC) - add_definitions(-DZ_POWER8) - set(ZLIB_POWER8 - contrib/power/adler32_power8.c -- contrib/power/crc32_z_power8.c) -+ contrib/power/crc32_z_power8.c -+ contrib/power/slide_hash_power8.c) - - set_source_files_properties( - ${ZLIB_POWER8} -diff --git a/Makefile.in b/Makefile.in -index 9ef9fa9..f71c6ea 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -183,6 +183,9 @@ crc32_z_power8.o: $(SRCDIR)contrib/power/crc32_z_power8.c - deflate.o: $(SRCDIR)deflate.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c - -+slide_hash_power8.o: $(SRCDIR)contrib/power/slide_hash_power8.c -+ $(CC) $(CFLAGS) -mcpu=power8 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/slide_hash_power8.c -+ - infback.o: $(SRCDIR)infback.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c - -@@ -245,6 +248,11 @@ deflate.lo: $(SRCDIR)deflate.c - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c - -@mv objs/deflate.o $@ - -+slide_hash_power8.lo: $(SRCDIR)contrib/power/slide_hash_power8.c -+ -@mkdir objs 2>/dev/null || test -d objs -+ $(CC) $(SFLAGS) -mcpu=power8 $(ZINC) -DPIC -c -o objs/slide_hash_power8.o $(SRCDIR)contrib/power/slide_hash_power8.c -+ -@mv objs/slide_hash_power8.o $@ -+ - infback.lo: $(SRCDIR)infback.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c -diff --git a/configure b/configure -index 810a740..d0dacf9 100755 ---- a/configure -+++ b/configure -@@ -879,8 +879,8 @@ if tryboth $CC -c $CFLAGS $test.c; then - - if tryboth $CC -c $CFLAGS -mcpu=power8 $test.c; then - POWER8="-DZ_POWER8" -- PIC_OBJC="${PIC_OBJC} adler32_power8.lo crc32_z_power8.lo" -- OBJC="${OBJC} adler32_power8.o crc32_z_power8.o" -+ PIC_OBJC="${PIC_OBJC} adler32_power8.lo crc32_z_power8.lo slide_hash_power8.lo" -+ OBJC="${OBJC} adler32_power8.o crc32_z_power8.o slide_hash_power8.o" - echo "Checking for -mcpu=power8 support... Yes." | tee -a configure.log - else - echo "Checking for -mcpu=power8 support... No." | tee -a configure.log -diff --git a/contrib/power/power.h b/contrib/power/power.h -index f57c761..28c8f78 100644 ---- a/contrib/power/power.h -+++ b/contrib/power/power.h -@@ -4,7 +4,10 @@ - */ - #include "../../zconf.h" - #include "../../zutil.h" -+#include "../../deflate.h" - - uLong _adler32_power8(uLong adler, const Bytef* buf, uInt len); - - unsigned long _crc32_z_power8(unsigned long, const Bytef *, z_size_t); -+ -+void _slide_hash_power8(deflate_state *s); -diff --git a/contrib/power/slide_hash_power8.c b/contrib/power/slide_hash_power8.c -new file mode 100644 -index 0000000..c5a0eb5 ---- /dev/null -+++ b/contrib/power/slide_hash_power8.c -@@ -0,0 +1,63 @@ -+ /* Copyright (C) 2019 Matheus Castanho , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ */ -+ -+#include -+#include "../../deflate.h" -+ -+local inline void slide_hash_power8_loop OF((deflate_state *s, -+ unsigned n_elems, Posf *table_end)) __attribute__((always_inline)); -+ -+local void slide_hash_power8_loop( -+ deflate_state *s, -+ unsigned n_elems, -+ Posf *table_end) -+{ -+ vector unsigned short vw, vm, *vp; -+ unsigned chunks; -+ -+ /* Each vector register (chunk) corresponds to 128 bits == 8 Posf, -+ * so instead of processing each of the n_elems in the hash table -+ * individually, we can do it in chunks of 8 with vector instructions. -+ * -+ * This function is only called from slide_hash_power8(), and both calls -+ * pass n_elems as a power of 2 higher than 2^7, as defined by -+ * deflateInit2_(), so n_elems will always be a multiple of 8. */ -+ chunks = n_elems >> 3; -+ Assert(n_elems % 8 == 0, "Weird hash table size!"); -+ -+ /* This type casting is safe since s->w_size is always <= 64KB -+ * as defined by deflateInit2_() and Posf == unsigned short */ -+ vw[0] = (Posf) s->w_size; -+ vw = vec_splat(vw,0); -+ -+ vp = (vector unsigned short *) table_end; -+ -+ do { -+ /* Processing 8 elements at a time */ -+ vp--; -+ vm = *vp; -+ -+ /* This is equivalent to: m >= w_size ? m - w_size : 0 -+ * Since we are using a saturated unsigned subtraction, any -+ * values that are > w_size will be set to 0, while the others -+ * will be subtracted by w_size. */ -+ *vp = vec_subs(vm,vw); -+ } while (--chunks); -+}; -+ -+void ZLIB_INTERNAL _slide_hash_power8(deflate_state *s) -+{ -+ unsigned n; -+ Posf *p; -+ -+ n = s->hash_size; -+ p = &s->head[n]; -+ slide_hash_power8_loop(s,n,p); -+ -+#ifndef FASTEST -+ n = s->w_size; -+ p = &s->prev[n]; -+ slide_hash_power8_loop(s,n,p); -+#endif -+} -diff --git a/contrib/power/slide_hash_resolver.c b/contrib/power/slide_hash_resolver.c -new file mode 100644 -index 0000000..54fa1eb ---- /dev/null -+++ b/contrib/power/slide_hash_resolver.c -@@ -0,0 +1,15 @@ -+/* Copyright (C) 2019 Matheus Castanho , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ */ -+ -+#include "../gcc/zifunc.h" -+#include "power.h" -+ -+Z_IFUNC(slide_hash) { -+#ifdef Z_POWER8 -+ if (__builtin_cpu_supports("arch_2_07")) -+ return _slide_hash_power8; -+#endif -+ -+ return slide_hash_default; -+} -diff --git a/deflate.c b/deflate.c -index 799fb93..b2db576 100644 ---- a/deflate.c -+++ b/deflate.c -@@ -196,6 +196,13 @@ local const config configuration_table[10] = { - (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ - } while (0) - -+#ifdef Z_POWER_OPT -+/* Rename function so resolver can use its symbol. The default version will be -+ * returned by the resolver if the host has no support for an optimized version. -+ */ -+#define slide_hash slide_hash_default -+#endif /* Z_POWER_OPT */ -+ - /* =========================================================================== - * Slide the hash table when sliding the window down (could be avoided with 32 - * bit values at the expense of memory usage). We slide even when level == 0 to -@@ -227,6 +234,11 @@ local void slide_hash(s) - #endif - } - -+#ifdef Z_POWER_OPT -+#undef slide_hash -+#include "contrib/power/slide_hash_resolver.c" -+#endif /* Z_POWER_OPT */ -+ - /* ========================================================================= */ - int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; --- -2.34.3 - - -From aecdff0646c7e188b48f6db285d8d63a74f246c1 Mon Sep 17 00:00:00 2001 -From: Matheus Castanho -Date: Tue, 29 Oct 2019 18:04:11 -0300 -Subject: [PATCH 9/9] Add vectorized longest_match for Power - -This commit introduces an optimized version of the longest_match -function for Power processors. It uses VSX instructions to match -16 bytes at a time on each comparison, instead of one by one. - -Author: Matheus Castanho ---- - CMakeLists.txt | 3 +- - Makefile.in | 8 + - configure | 4 +- - contrib/power/longest_match_power9.c | 194 +++++++++++++++++++++++++ - contrib/power/longest_match_resolver.c | 15 ++ - contrib/power/power.h | 2 + - deflate.c | 13 ++ - 7 files changed, 236 insertions(+), 3 deletions(-) - create mode 100644 contrib/power/longest_match_power9.c - create mode 100644 contrib/power/longest_match_resolver.c - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8208c62..017f88a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -199,7 +199,8 @@ if(CMAKE_COMPILER_IS_GNUCC) - - if(POWER9) - add_definitions(-DZ_POWER9) -- set(ZLIB_POWER9 ) -+ set(ZLIB_POWER9 -+ contrib/power/longest_match_power9.c) - - set_source_files_properties( - ${ZLIB_POWER9} -diff --git a/Makefile.in b/Makefile.in -index f71c6ea..be0a2bc 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -183,6 +183,9 @@ crc32_z_power8.o: $(SRCDIR)contrib/power/crc32_z_power8.c - deflate.o: $(SRCDIR)deflate.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c - -+longest_match_power9.o: $(SRCDIR)contrib/power/longest_match_power9.c -+ $(CC) $(CFLAGS) -mcpu=power9 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/longest_match_power9.c -+ - slide_hash_power8.o: $(SRCDIR)contrib/power/slide_hash_power8.c - $(CC) $(CFLAGS) -mcpu=power8 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/slide_hash_power8.c - -@@ -248,6 +251,11 @@ deflate.lo: $(SRCDIR)deflate.c - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c - -@mv objs/deflate.o $@ - -+longest_match_power9.lo: $(SRCDIR)contrib/power/longest_match_power9.c -+ -@mkdir objs 2>/dev/null || test -d objs -+ $(CC) $(SFLAGS) -mcpu=power9 $(ZINC) -DPIC -c -o objs/longest_match_power9.o $(SRCDIR)contrib/power/longest_match_power9.c -+ -@mv objs/longest_match_power9.o $@ -+ - slide_hash_power8.lo: $(SRCDIR)contrib/power/slide_hash_power8.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) -mcpu=power8 $(ZINC) -DPIC -c -o objs/slide_hash_power8.o $(SRCDIR)contrib/power/slide_hash_power8.c -diff --git a/configure b/configure -index d0dacf9..b723b64 100755 ---- a/configure -+++ b/configure -@@ -888,8 +888,8 @@ if tryboth $CC -c $CFLAGS $test.c; then - - if tryboth $CC -c $CFLAGS -mcpu=power9 $test.c; then - POWER9="-DZ_POWER9" -- PIC_OBJC="${PIC_OBJC}" -- OBJC="${OBJC}" -+ PIC_OBJC="$PIC_OBJC longest_match_power9.lo" -+ OBJC="$OBJC longest_match_power9.o" - echo "Checking for -mcpu=power9 support... Yes." | tee -a configure.log - else - echo "Checking for -mcpu=power9 support... No." | tee -a configure.log -diff --git a/contrib/power/longest_match_power9.c b/contrib/power/longest_match_power9.c -new file mode 100644 -index 0000000..5177873 ---- /dev/null -+++ b/contrib/power/longest_match_power9.c -@@ -0,0 +1,194 @@ -+/* Copyright (C) 2019 Matheus Castanho , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ */ -+ -+#include -+#include "../../deflate.h" -+ -+local inline int vec_match OF((Bytef* scan, Bytef* match)) -+ __attribute__((always_inline)); -+ -+local inline int vec_match(Bytef* scan, Bytef* match) -+{ -+ vector unsigned char vscan, vmatch, vc; -+ int len; -+ -+ vscan = *((vector unsigned char *) scan); -+ vmatch = *((vector unsigned char *) match); -+ -+ /* Compare 16 bytes at a time. -+ * Each byte of vc will be either all ones or all zeroes, -+ * depending on the result of the comparison -+ */ -+ vc = (vector unsigned char) vec_cmpne(vscan,vmatch); -+ -+ /* Since the index of matching bytes will contain only zeroes -+ * on vc (since we used cmpne), counting the number of consecutive -+ * bytes where LSB == 0 is the same as counting the length of the match. -+ * -+ * There was an issue in the way the vec_cnttz_lsbb builtin was implemented -+ * that got fixed on GCC 12, but now we have to use different builtins -+ * depending on the compiler version. To avoid that, let's use inline asm to -+ * generate the exact instruction we need. -+ */ -+ #ifdef __LITTLE_ENDIAN__ -+ asm volatile("vctzlsbb %0, %1\n\t" : "=r" (len) : "v" (vc)); -+ #else -+ asm volatile("vclzlsbb %0, %1\n\t" : "=r" (len) : "v" (vc)); -+ #endif -+ -+ return len; -+} -+ -+uInt ZLIB_INTERNAL _longest_match_power9(deflate_state *s, IPos cur_match) -+{ -+ unsigned chain_length = s->max_chain_length;/* max hash chain length */ -+ register Bytef *scan = s->window + s->strstart; /* current string */ -+ register Bytef *match; /* matched string */ -+ register int len; /* length of current match */ -+ int best_len = (int)s->prev_length; /* best match length so far */ -+ int nice_match = s->nice_match; /* stop if match long enough */ -+ int mbytes; /* matched bytes inside loop */ -+ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -+ s->strstart - (IPos)MAX_DIST(s) : 0; -+ /* Stop when cur_match becomes <= limit. To simplify the code, -+ * we prevent matches with the string of window index 0. -+ */ -+ Posf *prev = s->prev; -+ uInt wmask = s->w_mask; -+ -+#if (MAX_MATCH == 258) -+ /* Compare the last two bytes at once. */ -+ register Bytef *strend2 = s->window + s->strstart + MAX_MATCH - 2; -+ register ush scan_end = *(ushf*)(scan+best_len-1); -+#else -+ register Bytef *strend = s->window + s->strstart + MAX_MATCH; -+ register Byte scan_end1 = scan[best_len-1]; -+ register Byte scan_end = scan[best_len]; -+#endif -+ -+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. -+ * It is easy to get rid of this optimization if necessary. -+ */ -+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); -+ -+ /* Do not waste too much time if we already have a good match: */ -+ if (s->prev_length >= s->good_match) { -+ chain_length >>= 2; -+ } -+ /* Do not look for matches beyond the end of the input. This is necessary -+ * to make deflate deterministic. -+ */ -+ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; -+ -+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); -+ -+ do { -+ Assert(cur_match < s->strstart, "no future"); -+ match = s->window + cur_match; -+ -+ /* Skip to next match if the match length cannot increase -+ * or if the match length is less than 2. Note that the checks below -+ * for insufficient lookahead only occur occasionally for performance -+ * reasons. Therefore uninitialized memory will be accessed, and -+ * conditional jumps will be made that depend on those values. -+ * However the length of the match is limited to the lookahead, so -+ * the output of deflate is not affected by the uninitialized values. -+ */ -+ -+/* MAX_MATCH - 2 should be a multiple of 16 for this optimization to work. */ -+#if (MAX_MATCH == 258) -+ -+ /* Compare ending (2 bytes) and beginning of potential match. -+ * -+ * On Power processors, loading a 16-byte vector takes only 1 extra -+ * cycle compared to a regular byte load. So instead of comparing the -+ * first two bytes and then the rest later if they match, we can compare -+ * the first 16 at once, and when we have a match longer than 2, we will -+ * already have the result of comparing the first 16 bytes saved in mbytes. -+ */ -+ if (*(ushf*)(match+best_len-1) != scan_end || -+ (mbytes = vec_match(scan,match)) < 3) continue; -+ -+ scan += mbytes; -+ match += mbytes; -+ -+ /* In case when we may have a match longer than 16, we perform further -+ * comparisons in chunks of 16 and keep going while all bytes match. -+ */ -+ while(mbytes == 16) { -+ mbytes = vec_match(scan,match); -+ scan += mbytes; -+ match += mbytes; -+ -+ /* We also have to limit the maximum match based on MAX_MATCH. -+ * Since we are comparing 16 bytes at a time and MAX_MATCH == 258 (to -+ * comply with default implementation), we should stop comparing when -+ * we have matched 256 bytes, which happens when scan == strend2. -+ * In this ("rare") case, we have to check the remaining 2 bytes -+ * individually using common load and compare operations. -+ */ -+ if(scan >= strend2) { -+ if(*scan == *match) { -+ if(*++scan == *++match) -+ scan++; -+ } -+ break; -+ } -+ } -+ -+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); -+ -+ len = (MAX_MATCH - 2) - (int)(strend2 - scan); -+ scan = strend2 - (MAX_MATCH - 2); -+ -+#else /* MAX_MATCH == 258 */ -+ -+ if (match[best_len] != scan_end || -+ match[best_len-1] != scan_end1 || -+ *match != *scan || -+ *++match != scan[1]) continue; -+ -+ /* The check at best_len-1 can be removed because it will be made -+ * again later. (This heuristic is not always a win.) -+ * It is not necessary to compare scan[2] and match[2] since they -+ * are always equal when the other bytes match, given that -+ * the hash keys are equal and that HASH_BITS >= 8. -+ */ -+ scan += 2, match++; -+ Assert(*scan == *match, "match[2]?"); -+ -+ /* We check for insufficient lookahead only every 8th comparison; -+ * the 256th check will be made at strstart+258. -+ */ -+ do { -+ } while (*++scan == *++match && *++scan == *++match && -+ *++scan == *++match && *++scan == *++match && -+ *++scan == *++match && *++scan == *++match && -+ *++scan == *++match && *++scan == *++match && -+ scan < strend); -+ -+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); -+ -+ len = MAX_MATCH - (int)(strend - scan); -+ scan = strend - MAX_MATCH; -+ -+#endif /* MAX_MATCH == 258 */ -+ -+ if (len > best_len) { -+ s->match_start = cur_match; -+ best_len = len; -+ if (len >= nice_match) break; -+#if (MAX_MATCH == 258) -+ scan_end = *(ushf*)(scan+best_len-1); -+#else -+ scan_end1 = scan[best_len-1]; -+ scan_end = scan[best_len]; -+#endif -+ } -+ } while ((cur_match = prev[cur_match & wmask]) > limit -+ && --chain_length != 0); -+ -+ if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -+ return s->lookahead; -+} -diff --git a/contrib/power/longest_match_resolver.c b/contrib/power/longest_match_resolver.c -new file mode 100644 -index 0000000..e81f28a ---- /dev/null -+++ b/contrib/power/longest_match_resolver.c -@@ -0,0 +1,15 @@ -+/* Copyright (C) 2019 Matheus Castanho , IBM -+ * For conditions of distribution and use, see copyright notice in zlib.h -+ */ -+ -+#include "../gcc/zifunc.h" -+#include "power.h" -+ -+Z_IFUNC(longest_match) { -+#ifdef Z_POWER9 -+ if (__builtin_cpu_supports("arch_3_00")) -+ return _longest_match_power9; -+#endif -+ -+ return longest_match_default; -+} -diff --git a/contrib/power/power.h b/contrib/power/power.h -index 28c8f78..62ca81b 100644 ---- a/contrib/power/power.h -+++ b/contrib/power/power.h -@@ -10,4 +10,6 @@ uLong _adler32_power8(uLong adler, const Bytef* buf, uInt len); - - unsigned long _crc32_z_power8(unsigned long, const Bytef *, z_size_t); - -+uInt _longest_match_power9(deflate_state *s, IPos cur_match); -+ - void _slide_hash_power8(deflate_state *s); -diff --git a/deflate.c b/deflate.c -index b2db576..d7b30b5 100644 ---- a/deflate.c -+++ b/deflate.c -@@ -1285,6 +1285,14 @@ local void lm_init (s) - /* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -+ -+#ifdef Z_POWER_OPT -+/* Rename function so resolver can use its symbol. The default version will be -+ * returned by the resolver if the host has no support for an optimized version. -+ */ -+#define longest_match longest_match_default -+#endif /* Z_POWER_OPT */ -+ - local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -@@ -1429,6 +1437,11 @@ local uInt longest_match(s, cur_match) - } - #endif /* ASMV */ - -+#ifdef Z_POWER_OPT -+#undef longest_match -+#include "contrib/power/longest_match_resolver.c" -+#endif /* Z_POWER_OPT */ -+ - #else /* FASTEST */ - - /* --------------------------------------------------------------------------- --- -2.34.3 +2.37.3 diff --git a/zlib-1.2.12-s390x-vectorize-crc32.patch b/zlib-1.2.13-s390x-vectorize-crc32.patch similarity index 95% rename from zlib-1.2.12-s390x-vectorize-crc32.patch rename to zlib-1.2.13-s390x-vectorize-crc32.patch index d354940..a102523 100644 --- a/zlib-1.2.12-s390x-vectorize-crc32.patch +++ b/zlib-1.2.13-s390x-vectorize-crc32.patch @@ -1,4 +1,4 @@ -From 957bc67cfb4e01403c01fe6243850383183a7c19 Mon Sep 17 00:00:00 2001 +From 6ae549062cb4b766c5cc726406f8612310cc12b5 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Thu, 19 Mar 2020 11:52:03 +0100 Subject: [PATCH] s390x: vectorize crc32 @@ -19,18 +19,18 @@ choose between the regular and the vectorized implementations. create mode 100644 contrib/s390/crc32_z_resolver.c diff --git a/Makefile.in b/Makefile.in -index 2e78f38..04c2f5d 100644 +index a811c10..af62c22 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -29,6 +29,7 @@ LDFLAGS= - TEST_LDFLAGS=-L. libz.a +@@ -25,6 +25,7 @@ LDFLAGS= + TEST_LDFLAGS=$(LDFLAGS) -L. libz.a LDSHARED=$(CC) CPP=$(CC) -E +VGFMAFLAG= STATICLIB=libz.a SHAREDLIB=libz.so -@@ -179,6 +180,9 @@ crc32.o: $(SRCDIR)crc32.c +@@ -175,6 +176,9 @@ crc32.o: $(SRCDIR)crc32.c crc32_z_power8.o: $(SRCDIR)contrib/power/crc32_z_power8.c $(CC) $(CFLAGS) -mcpu=power8 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/crc32_z_power8.c @@ -40,7 +40,7 @@ index 2e78f38..04c2f5d 100644 deflate.o: $(SRCDIR)deflate.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c -@@ -229,6 +233,11 @@ crc32.lo: $(SRCDIR)crc32.c +@@ -225,6 +229,11 @@ crc32.lo: $(SRCDIR)crc32.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c -@mv objs/crc32.o $@ @@ -53,11 +53,11 @@ index 2e78f38..04c2f5d 100644 -@mkdir objs 2>/dev/null || test -d objs $(CC) $(SFLAGS) -mcpu=power8 $(ZINC) -DPIC -c -o objs/crc32_z_power8.o $(SRCDIR)contrib/power/crc32_z_power8.c diff --git a/configure b/configure -index dd01b5c..acf94a5 100755 +index ab3204a..04ee943 100755 --- a/configure +++ b/configure -@@ -927,6 +927,32 @@ else - echo "Checking for sys/sdt.h ... No." | tee -a configure.log +@@ -921,6 +921,32 @@ else + echo "Checking for Power optimizations support... No." | tee -a configure.log fi +# check if we are compiling for s390 and binutils support vector extensions @@ -89,7 +89,7 @@ index dd01b5c..acf94a5 100755 # show the results in the log echo >> configure.log echo ALL = $ALL >> configure.log -@@ -960,6 +986,7 @@ echo mandir = $mandir >> configure.log +@@ -952,6 +978,7 @@ echo mandir = $mandir >> configure.log echo prefix = $prefix >> configure.log echo sharedlibdir = $sharedlibdir >> configure.log echo uname = $uname >> configure.log @@ -97,7 +97,7 @@ index dd01b5c..acf94a5 100755 # udpate Makefile with the configure results sed < ${SRCDIR}Makefile.in " -@@ -969,6 +996,7 @@ sed < ${SRCDIR}Makefile.in " +@@ -961,6 +988,7 @@ sed < ${SRCDIR}Makefile.in " /^LDFLAGS *=/s#=.*#=$LDFLAGS# /^LDSHARED *=/s#=.*#=$LDSHARED# /^CPP *=/s#=.*#=$CPP# @@ -388,10 +388,10 @@ index 0000000..9749cab + return crc32_z_default; +} diff --git a/crc32.c b/crc32.c -index ae7b7e7..c212261 100644 +index 4e5830b..0b458ce 100644 --- a/crc32.c +++ b/crc32.c -@@ -736,12 +736,12 @@ local z_word_t crc_word_big(data) +@@ -745,12 +745,12 @@ local z_word_t crc_word_big(data) #endif /* ========================================================================= */ @@ -406,7 +406,7 @@ index ae7b7e7..c212261 100644 unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; -@@ -1064,10 +1064,15 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) +@@ -1073,10 +1073,15 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) return crc ^ 0xffffffff; } @@ -424,5 +424,5 @@ index ae7b7e7..c212261 100644 #endif -- -2.35.1 +2.37.3 diff --git a/zlib.spec b/zlib.spec index b348aad..8c4f272 100644 --- a/zlib.spec +++ b/zlib.spec @@ -1,8 +1,8 @@ %bcond_without minizip Name: zlib -Version: 1.2.12 -Release: 5%{?dist} +Version: 1.2.13 +Release: 1%{?dist} Summary: Compression and decompression library # /contrib/dotzlib/ have Boost license License: zlib and Boost @@ -12,30 +12,21 @@ Source: https://www.zlib.net/zlib-%{version}.tar.xz # https://github.com/madler/zlib/pull/210 Patch0: zlib-1.2.5-minizip-fixuncrypt.patch # resolves: #805113 -Patch1: zlib-1.2.11-optimized-s390.patch +Patch1: zlib-1.2.13-optimized-s390.patch +# IBM optimized crc32 for Power 8+ processors +# ref: https://github.com/madler/zlib/pull/750 +Patch18: zlib-1.2.13-power-optimizations.patch # IBM Z hardware-accelerated deflate # ref: https://github.com/madler/zlib/pull/410 -Patch18: zlib-1.2.12-IBM-Z-hw-accelerated-deflate.patch -# IBM optimized crc32 for Power 8+ processors -# ref: https://github.com/madler/zlib/pull/478 -Patch19: zlib-1.2.12-power-optimizations.patch +Patch19: zlib-1.2.13-IBM-Z-hw-accelerated-deflate.patch # Patch for s390x crc32vx # ref: https://github.com/iii-i/zlib/releases/tag/crc32vx-v3 -Patch20: zlib-1.2.12-s390x-vectorize-crc32.patch -# Fix for configure -# ref: https://github.com/madler/zlib/pull/607/commits/80d086357a55b94a13e43756cf3e131f25eef0e4 -Patch21: zlib-1.2.12-fix-configure.patch +Patch20: zlib-1.2.13-s390x-vectorize-crc32.patch # fixed covscan issues Patch22: zlib-1.2.11-covscan-issues.patch # fixed issues found by covscan for rhel-9 # ref: https://github.com/madler/zlib/pull/554 Patch23: zlib-1.2.11-covscan-issues-rhel9.patch -# Correct incorrect inputs provided to the CRC functions. -# ref: https://github.com/madler/zlib/commit/ec3df00224d4b396e2ac6586ab5d25f673caa4c2 -Patch24: zlib-1.2.12-correct-inputs-provided-to-crc-func.patch -# Fix for CVE-2022-37434 -# ref: https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d -Patch25: zlib-1.2.12-fix-CVE-2022-37434.patch BuildRequires: make BuildRequires: automake, autoconf, libtool @@ -94,11 +85,8 @@ developing applications which use minizip. %patch18 -p1 %patch19 -p1 %patch20 -p1 -%patch21 -p1 %patch22 -p1 %patch23 -p1 -%patch24 -p1 -%patch25 -p1 # Patch19 conflicts with Patch1, so the Patch1 has to be applied after, # because it is arch specific %ifarch s390 s390x @@ -181,6 +169,10 @@ find $RPM_BUILD_ROOT -name '*.la' -delete %changelog +* Mon Oct 17 2022 Lukas Javorsky - 1.2.13-1 +- Rebase to version 1.2.13 +- Patches 21,24,25 has been upstreamed + * Tue Aug 09 2022 Lukas Javorsky - 1.2.12-5 - Fix heap-based buffer over-read or buffer overflow in inflate in inflate.c - Resolves: CVE-2022-37434