Compare commits
No commits in common. "c8" and "c10s" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
||||
SOURCES/zlib-1.2.11.tar.xz
|
@ -1 +0,0 @@
|
||||
e1cb0d5c92da8e9a8c2635dfa249c341dfd00322 SOURCES/zlib-1.2.11.tar.xz
|
File diff suppressed because it is too large
Load Diff
@ -1,346 +0,0 @@
|
||||
From 5c44459c3b28a9bd3283aaceab7c615f8020c531 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Tue, 17 Apr 2018 22:09:22 -0700
|
||||
Subject: [PATCH] Fix a bug that can crash deflate on some input when using
|
||||
Z_FIXED.
|
||||
|
||||
This bug was reported by Danilo Ramos of Eideticom, Inc. It has
|
||||
lain in wait 13 years before being found! The bug was introduced
|
||||
in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
|
||||
option forces the use of fixed Huffman codes. For rare inputs with
|
||||
a large number of distant matches, the pending buffer into which
|
||||
the compressed data is written can overwrite the distance symbol
|
||||
table which it overlays. That results in corrupted output due to
|
||||
invalid distances, and can result in out-of-bound accesses,
|
||||
crashing the application.
|
||||
|
||||
The fix here combines the distance buffer and literal/length
|
||||
buffers into a single symbol buffer. Now three bytes of pending
|
||||
buffer space are opened up for each literal or length/distance
|
||||
pair consumed, instead of the previous two bytes. This assures
|
||||
that the pending buffer cannot overwrite the symbol table, since
|
||||
the maximum fixed code compressed length/distance is 31 bits, and
|
||||
since there are four bytes of pending space for every three bytes
|
||||
of symbol space.
|
||||
---
|
||||
deflate.c | 74 ++++++++++++++++++++++++++++++++++++++++---------------
|
||||
deflate.h | 25 +++++++++----------
|
||||
trees.c | 50 +++++++++++--------------------------
|
||||
3 files changed, 79 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index 425babc..19cba87 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -255,11 +255,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||
int wrap = 1;
|
||||
static const char my_version[] = ZLIB_VERSION;
|
||||
|
||||
- ushf *overlay;
|
||||
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
|
||||
- * output size for (length,distance) codes is <= 24 bits.
|
||||
- */
|
||||
-
|
||||
if (version == Z_NULL || version[0] != my_version[0] ||
|
||||
stream_size != sizeof(z_stream)) {
|
||||
return Z_VERSION_ERROR;
|
||||
@@ -329,9 +324,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||
|
||||
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
||||
|
||||
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
||||
- s->pending_buf = (uchf *) overlay;
|
||||
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
|
||||
+ /* We overlay pending_buf and sym_buf. This works since the average size
|
||||
+ * for length/distance pairs over any compressed block is assured to be 31
|
||||
+ * bits or less.
|
||||
+ *
|
||||
+ * Analysis: The longest fixed codes are a length code of 8 bits plus 5
|
||||
+ * extra bits, for lengths 131 to 257. The longest fixed distance codes are
|
||||
+ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
|
||||
+ * possible fixed-codes length/distance pair is then 31 bits total.
|
||||
+ *
|
||||
+ * sym_buf starts one-fourth of the way into pending_buf. So there are
|
||||
+ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
|
||||
+ * in sym_buf is three bytes -- two for the distance and one for the
|
||||
+ * literal/length. As each symbol is consumed, the pointer to the next
|
||||
+ * sym_buf value to read moves forward three bytes. From that symbol, up to
|
||||
+ * 31 bits are written to pending_buf. The closest the written pending_buf
|
||||
+ * bits gets to the next sym_buf symbol to read is just before the last
|
||||
+ * code is written. At that time, 31*(n-2) bits have been written, just
|
||||
+ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
|
||||
+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
|
||||
+ * symbols are written.) The closest the writing gets to what is unread is
|
||||
+ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
||||
+ * can range from 128 to 32768.
|
||||
+ *
|
||||
+ * Therefore, at a minimum, there are 142 bits of space between what is
|
||||
+ * written and what is read in the overlain buffers, so the symbols cannot
|
||||
+ * be overwritten by the compressed data. That space is actually 139 bits,
|
||||
+ * due to the three-bit fixed-code block header.
|
||||
+ *
|
||||
+ * That covers the case where either Z_FIXED is specified, forcing fixed
|
||||
+ * codes, or when the use of fixed codes is chosen, because that choice
|
||||
+ * results in a smaller compressed block than dynamic codes. That latter
|
||||
+ * condition then assures that the above analysis also covers all dynamic
|
||||
+ * blocks. A dynamic-code block will only be chosen to be emitted if it has
|
||||
+ * fewer bits than a fixed-code block would for the same set of symbols.
|
||||
+ * Therefore its average symbol length is assured to be less than 31. So
|
||||
+ * the compressed data for a dynamic block also cannot overwrite the
|
||||
+ * symbols from which it is being constructed.
|
||||
+ */
|
||||
+
|
||||
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
|
||||
+ s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
||||
|
||||
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
||||
s->pending_buf == Z_NULL) {
|
||||
@@ -340,8 +373,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||
deflateEnd (strm);
|
||||
return Z_MEM_ERROR;
|
||||
}
|
||||
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
|
||||
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
|
||||
+ s->sym_buf = s->pending_buf + s->lit_bufsize;
|
||||
+ s->sym_end = (s->lit_bufsize - 1) * 3;
|
||||
+ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
||||
+ * on 16 bit machines and because stored blocks are restricted to
|
||||
+ * 64K-1 bytes.
|
||||
+ */
|
||||
|
||||
s->level = level;
|
||||
s->strategy = strategy;
|
||||
@@ -552,7 +589,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
|
||||
|
||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||
s = strm->state;
|
||||
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
|
||||
+ if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
||||
return Z_BUF_ERROR;
|
||||
do {
|
||||
put = Buf_size - s->bi_valid;
|
||||
@@ -1113,7 +1150,6 @@ int ZEXPORT deflateCopy (dest, source)
|
||||
#else
|
||||
deflate_state *ds;
|
||||
deflate_state *ss;
|
||||
- ushf *overlay;
|
||||
|
||||
|
||||
if (deflateStateCheck(source) || dest == Z_NULL) {
|
||||
@@ -1133,8 +1169,7 @@ int ZEXPORT deflateCopy (dest, source)
|
||||
ds->window = (Bytef *) ZALLOC_WINDOW(dest, ds->w_size, 2*sizeof(Byte));
|
||||
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
||||
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
||||
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
|
||||
- ds->pending_buf = (uchf *) overlay;
|
||||
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
|
||||
|
||||
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
||||
ds->pending_buf == Z_NULL) {
|
||||
@@ -1148,8 +1183,7 @@ int ZEXPORT deflateCopy (dest, source)
|
||||
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
||||
|
||||
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
||||
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
|
||||
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
|
||||
+ ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
|
||||
|
||||
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
||||
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
||||
@@ -1925,7 +1959,7 @@ local block_state deflate_fast(s, flush)
|
||||
FLUSH_BLOCK(s, 1);
|
||||
return finish_done;
|
||||
}
|
||||
- if (s->last_lit)
|
||||
+ if (s->sym_next)
|
||||
FLUSH_BLOCK(s, 0);
|
||||
return block_done;
|
||||
}
|
||||
@@ -2056,7 +2090,7 @@ local block_state deflate_slow(s, flush)
|
||||
FLUSH_BLOCK(s, 1);
|
||||
return finish_done;
|
||||
}
|
||||
- if (s->last_lit)
|
||||
+ if (s->sym_next)
|
||||
FLUSH_BLOCK(s, 0);
|
||||
return block_done;
|
||||
}
|
||||
@@ -2131,7 +2165,7 @@ local block_state deflate_rle(s, flush)
|
||||
FLUSH_BLOCK(s, 1);
|
||||
return finish_done;
|
||||
}
|
||||
- if (s->last_lit)
|
||||
+ if (s->sym_next)
|
||||
FLUSH_BLOCK(s, 0);
|
||||
return block_done;
|
||||
}
|
||||
@@ -2170,7 +2204,7 @@ local block_state deflate_huff(s, flush)
|
||||
FLUSH_BLOCK(s, 1);
|
||||
return finish_done;
|
||||
}
|
||||
- if (s->last_lit)
|
||||
+ if (s->sym_next)
|
||||
FLUSH_BLOCK(s, 0);
|
||||
return block_done;
|
||||
}
|
||||
diff --git a/deflate.h b/deflate.h
|
||||
index 23ecdd3..d4cf1a9 100644
|
||||
--- a/deflate.h
|
||||
+++ b/deflate.h
|
||||
@@ -217,7 +217,7 @@ typedef struct internal_state {
|
||||
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
||||
*/
|
||||
|
||||
- uchf *l_buf; /* buffer for literals or lengths */
|
||||
+ uchf *sym_buf; /* buffer for distances and literals/lengths */
|
||||
|
||||
uInt lit_bufsize;
|
||||
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
||||
@@ -239,13 +239,8 @@ typedef struct internal_state {
|
||||
* - I can't count above 4
|
||||
*/
|
||||
|
||||
- uInt last_lit; /* running index in l_buf */
|
||||
-
|
||||
- ushf *d_buf;
|
||||
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
|
||||
- * the same number of elements. To use different lengths, an extra flag
|
||||
- * array would be necessary.
|
||||
- */
|
||||
+ uInt sym_next; /* running index in sym_buf */
|
||||
+ uInt sym_end; /* symbol table full when sym_next reaches this */
|
||||
|
||||
ulg opt_len; /* bit length of current block with optimal trees */
|
||||
ulg static_len; /* bit length of current block with static trees */
|
||||
@@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
||||
|
||||
# define _tr_tally_lit(s, c, flush) \
|
||||
{ uch cc = (c); \
|
||||
- s->d_buf[s->last_lit] = 0; \
|
||||
- s->l_buf[s->last_lit++] = cc; \
|
||||
+ s->sym_buf[s->sym_next++] = 0; \
|
||||
+ s->sym_buf[s->sym_next++] = 0; \
|
||||
+ s->sym_buf[s->sym_next++] = cc; \
|
||||
s->dyn_ltree[cc].Freq++; \
|
||||
- flush = (s->last_lit == s->lit_bufsize-1); \
|
||||
+ flush = (s->sym_next == s->sym_end); \
|
||||
}
|
||||
# define _tr_tally_dist(s, distance, length, flush) \
|
||||
{ uch len = (uch)(length); \
|
||||
ush dist = (ush)(distance); \
|
||||
- s->d_buf[s->last_lit] = dist; \
|
||||
- s->l_buf[s->last_lit++] = len; \
|
||||
+ s->sym_buf[s->sym_next++] = dist; \
|
||||
+ s->sym_buf[s->sym_next++] = dist >> 8; \
|
||||
+ s->sym_buf[s->sym_next++] = len; \
|
||||
dist--; \
|
||||
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
||||
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||
- flush = (s->last_lit == s->lit_bufsize-1); \
|
||||
+ flush = (s->sym_next == s->sym_end); \
|
||||
}
|
||||
#else
|
||||
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
||||
diff --git a/trees.c b/trees.c
|
||||
index 4f4a650..decaeb7 100644
|
||||
--- a/trees.c
|
||||
+++ b/trees.c
|
||||
@@ -416,7 +416,7 @@ local void init_block(s)
|
||||
|
||||
s->dyn_ltree[END_BLOCK].Freq = 1;
|
||||
s->opt_len = s->static_len = 0L;
|
||||
- s->last_lit = s->matches = 0;
|
||||
+ s->sym_next = s->matches = 0;
|
||||
}
|
||||
|
||||
#define SMALLEST 1
|
||||
@@ -948,7 +948,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||
|
||||
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||
- s->last_lit));
|
||||
+ s->sym_next / 3));
|
||||
|
||||
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
||||
|
||||
@@ -1017,8 +1017,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
||||
unsigned dist; /* distance of matched string */
|
||||
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
||||
{
|
||||
- s->d_buf[s->last_lit] = (ush)dist;
|
||||
- s->l_buf[s->last_lit++] = (uch)lc;
|
||||
+ s->sym_buf[s->sym_next++] = dist;
|
||||
+ s->sym_buf[s->sym_next++] = dist >> 8;
|
||||
+ s->sym_buf[s->sym_next++] = lc;
|
||||
if (dist == 0) {
|
||||
/* lc is the unmatched char */
|
||||
s->dyn_ltree[lc].Freq++;
|
||||
@@ -1033,30 +1034,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
||||
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
|
||||
s->dyn_dtree[d_code(dist)].Freq++;
|
||||
}
|
||||
-
|
||||
-#ifdef TRUNCATE_BLOCK
|
||||
- /* Try to guess if it is profitable to stop the current block here */
|
||||
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
|
||||
- /* Compute an upper bound for the compressed length */
|
||||
- ulg out_length = (ulg)s->last_lit*8L;
|
||||
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
|
||||
- int dcode;
|
||||
- for (dcode = 0; dcode < D_CODES; dcode++) {
|
||||
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
|
||||
- (5L+extra_dbits[dcode]);
|
||||
- }
|
||||
- out_length >>= 3;
|
||||
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
||||
- s->last_lit, in_length, out_length,
|
||||
- 100L - out_length*100L/in_length));
|
||||
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
|
||||
- }
|
||||
-#endif
|
||||
- return (s->last_lit == s->lit_bufsize-1);
|
||||
- /* We avoid equality with lit_bufsize because of wraparound at 64K
|
||||
- * on 16 bit machines and because stored blocks are restricted to
|
||||
- * 64K-1 bytes.
|
||||
- */
|
||||
+ return (s->sym_next == s->sym_end);
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
@@ -1069,13 +1047,14 @@ local void compress_block(s, ltree, dtree)
|
||||
{
|
||||
unsigned dist; /* distance of matched string */
|
||||
int lc; /* match length or unmatched char (if dist == 0) */
|
||||
- unsigned lx = 0; /* running index in l_buf */
|
||||
+ unsigned sx = 0; /* running index in sym_buf */
|
||||
unsigned code; /* the code to send */
|
||||
int extra; /* number of extra bits to send */
|
||||
|
||||
- if (s->last_lit != 0) do {
|
||||
- dist = s->d_buf[lx];
|
||||
- lc = s->l_buf[lx++];
|
||||
+ if (s->sym_next != 0) do {
|
||||
+ dist = s->sym_buf[sx++] & 0xff;
|
||||
+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
|
||||
+ lc = s->sym_buf[sx++];
|
||||
if (dist == 0) {
|
||||
send_code(s, lc, ltree); /* send a literal byte */
|
||||
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
||||
@@ -1100,11 +1079,10 @@ local void compress_block(s, ltree, dtree)
|
||||
}
|
||||
} /* literal or match pair ? */
|
||||
|
||||
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
||||
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
||||
- "pendingBuf overflow");
|
||||
+ /* Check that the overlay between pending_buf and sym_buf is ok: */
|
||||
+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
|
||||
|
||||
- } while (lx < s->last_lit);
|
||||
+ } while (sx < s->sym_next);
|
||||
|
||||
send_code(s, END_BLOCK, ltree);
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,73 +0,0 @@
|
||||
From 5eaae2af0defeca148c2a281873bb31a15246876 Mon Sep 17 00:00:00 2001
|
||||
From: Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
Date: Thu, 2 Feb 2023 19:34:24 +0100
|
||||
Subject: [PATCH] 2155328
|
||||
|
||||
---
|
||||
contrib/s390/dfltcc.c | 21 +++++++++++++++------
|
||||
1 file changed, 15 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
|
||||
index 72099e7..f8dc21c 100644
|
||||
--- a/contrib/s390/dfltcc.c
|
||||
+++ b/contrib/s390/dfltcc.c
|
||||
@@ -456,7 +456,10 @@ again:
|
||||
*strm->next_out = (Bytef)state->bi_buf;
|
||||
/* Honor history and check value */
|
||||
param->nt = 0;
|
||||
- param->cv = state->wrap == 2 ? ZSWAP32(strm->adler) : strm->adler;
|
||||
+ if (state->wrap == 1)
|
||||
+ param->cv = strm->adler;
|
||||
+ else if (state->wrap == 2)
|
||||
+ param->cv = ZSWAP32(strm->adler);
|
||||
|
||||
/* When opening a block, choose a Huffman-Table Type */
|
||||
if (!param->bcf) {
|
||||
@@ -488,7 +491,10 @@ again:
|
||||
state->bi_buf = 0; /* Avoid accessing next_out */
|
||||
else
|
||||
state->bi_buf = *strm->next_out & ((1 << state->bi_valid) - 1);
|
||||
- strm->adler = state->wrap == 2 ? ZSWAP32(param->cv) : param->cv;
|
||||
+ if (state->wrap == 1)
|
||||
+ strm->adler = param->cv;
|
||||
+ else if (state->wrap == 2)
|
||||
+ strm->adler = ZSWAP32(param->cv);
|
||||
|
||||
/* Unmask the input data */
|
||||
strm->avail_in += masked_avail_in;
|
||||
@@ -600,11 +606,12 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(strm, flush, ret)
|
||||
}
|
||||
|
||||
/* Translate stream to parameter block */
|
||||
- param->cvt = state->flags ? CVT_CRC32 : CVT_ADLER32;
|
||||
+ param->cvt = ((state->wrap & 4) && state->flags) ? CVT_CRC32 : CVT_ADLER32;
|
||||
param->sbb = state->bits;
|
||||
if (param->hl)
|
||||
param->nt = 0; /* Honor history for the first block */
|
||||
- param->cv = state->flags ? ZSWAP32(state->check) : state->check;
|
||||
+ if (state->wrap & 4)
|
||||
+ param->cv = state->flags ? ZSWAP32(state->check) : state->check;
|
||||
|
||||
/* Inflate */
|
||||
do {
|
||||
@@ -615,7 +622,9 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(strm, flush, ret)
|
||||
strm->msg = oesc_msg(dfltcc_state->msg, param->oesc);
|
||||
state->last = cc == DFLTCC_CC_OK;
|
||||
state->bits = param->sbb;
|
||||
- strm->adler = state->check = state->flags ? ZSWAP32(param->cv) : param->cv;
|
||||
+ if (state->wrap & 4)
|
||||
+ 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;
|
||||
@@ -1077,4 +1086,4 @@ int ZLIB_INTERNAL dfltcc_inflate_get_dictionary(strm, dictionary, dict_length)
|
||||
if (dict_length)
|
||||
*dict_length = param->hl;
|
||||
return Z_OK;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From 480b65cae6c20a41aa698a6c9d3b260f6f744004 Mon Sep 17 00:00:00 2001
|
||||
From: Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
Date: Thu, 2 Feb 2023 19:41:32 +0100
|
||||
Subject: [PATCH] 0003-PATCH-Fix-clang-s-behavior-on-versions-7.patch
|
||||
|
||||
---
|
||||
contrib/power/clang_workaround.h | 15 ++++++++++-----
|
||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/contrib/power/clang_workaround.h b/contrib/power/clang_workaround.h
|
||||
index b5e7dae..915f7e5 100644
|
||||
--- a/contrib/power/clang_workaround.h
|
||||
+++ b/contrib/power/clang_workaround.h
|
||||
@@ -39,7 +39,12 @@ __vector unsigned long long __builtin_pack_vector (unsigned long __a,
|
||||
return __v;
|
||||
}
|
||||
|
||||
-#ifndef vec_xxpermdi
|
||||
+/*
|
||||
+ * Clang 7 changed the behavior of vec_xxpermdi in order to provide the same
|
||||
+ * behavior of GCC. That means code adapted to Clang >= 7 does not work on
|
||||
+ * Clang <= 6. So, fallback to __builtin_unpack_vector() on Clang <= 6.
|
||||
+ */
|
||||
+#if !defined vec_xxpermdi || __clang_major__ <= 6
|
||||
|
||||
static inline
|
||||
unsigned long __builtin_unpack_vector (__vector unsigned long long __v,
|
||||
@@ -62,9 +67,9 @@ static inline
|
||||
unsigned long __builtin_unpack_vector_0 (__vector unsigned long long __v)
|
||||
{
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
- return vec_xxpermdi(__v, __v, 0x0)[1];
|
||||
- #else
|
||||
return vec_xxpermdi(__v, __v, 0x0)[0];
|
||||
+ #else
|
||||
+ return vec_xxpermdi(__v, __v, 0x3)[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -72,9 +77,9 @@ static inline
|
||||
unsigned long __builtin_unpack_vector_1 (__vector unsigned long long __v)
|
||||
{
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
- return vec_xxpermdi(__v, __v, 0x3)[1];
|
||||
- #else
|
||||
return vec_xxpermdi(__v, __v, 0x3)[0];
|
||||
+ #else
|
||||
+ return vec_xxpermdi(__v, __v, 0x0)[0];
|
||||
#endif
|
||||
}
|
||||
#endif /* vec_xxpermdi */
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,206 +0,0 @@
|
||||
Subject: [PATCH] Fixed DFLTCC compression level switching issues
|
||||
|
||||
---
|
||||
configure | 4 +--
|
||||
contrib/s390/dfltcc.c | 52 ++++++++++++++++++++++++++++++-----
|
||||
contrib/s390/dfltcc_deflate.h | 2 ++
|
||||
deflate.c | 12 ++++----
|
||||
test/infcover.c | 2 +-
|
||||
5 files changed, 57 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index bfe4386..70ed86b 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -139,7 +139,7 @@ case "$1" in
|
||||
-w* | --warn) warn=1; shift ;;
|
||||
-d* | --debug) debug=1; shift ;;
|
||||
--dfltcc)
|
||||
- CFLAGS="$CFLAGS -DDFLTCC"
|
||||
+ CFLAGS="$CFLAGS -DDFLTCC -DDFLTCC_LEVEL_MASK=0x7e"
|
||||
OBJC="$OBJC dfltcc.o"
|
||||
PIC_OBJC="$PIC_OBJC dfltcc.lo"
|
||||
shift
|
||||
@@ -838,7 +838,7 @@ cat > $test.c << EOF
|
||||
#include <sys/sdt.h>
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
-if try ${CC} ${CFLAGS} $test.c; then
|
||||
+ if try $CC -c $CFLAGS $test.c; then
|
||||
echo "Checking for sys/sdt.h ... Yes." | tee -a configure.log
|
||||
CFLAGS="$CFLAGS -DHAVE_SYS_SDT_H"
|
||||
SFLAGS="$SFLAGS -DHAVE_SYS_SDT_H"
|
||||
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
|
||||
index d88a0d6..94a196f 100644
|
||||
--- a/contrib/s390/dfltcc.c
|
||||
+++ b/contrib/s390/dfltcc.c
|
||||
@@ -350,8 +350,12 @@ int ZLIB_INTERNAL dfltcc_deflate(strm, flush, result)
|
||||
int soft_bcc;
|
||||
int no_flush;
|
||||
|
||||
- if (!dfltcc_can_deflate(strm))
|
||||
+ if (!dfltcc_can_deflate(strm)) {
|
||||
+ /* Clear history. */
|
||||
+ if (flush == Z_FULL_FLUSH)
|
||||
+ param->hl = 0;
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
again:
|
||||
masked_avail_in = 0;
|
||||
@@ -376,7 +380,8 @@ again:
|
||||
/* Clear history. */
|
||||
if (flush == Z_FULL_FLUSH)
|
||||
param->hl = 0;
|
||||
- *result = need_more;
|
||||
+ /* Trigger block post-processing if necessary. */
|
||||
+ *result = no_flush ? need_more : block_done;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -403,13 +408,18 @@ again:
|
||||
param->bcf = 0;
|
||||
dfltcc_state->block_threshold =
|
||||
strm->total_in + dfltcc_state->block_size;
|
||||
- if (strm->avail_out == 0) {
|
||||
- *result = need_more;
|
||||
- return 1;
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
+ /* No space for compressed data. If we proceed, dfltcc_cmpr() will return
|
||||
+ * DFLTCC_CC_OP1_TOO_SHORT without buffering header bits, but we will still
|
||||
+ * set BCF=1, which is wrong. Avoid complications and return early.
|
||||
+ */
|
||||
+ if (strm->avail_out == 0) {
|
||||
+ *result = need_more;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
/* The caller gave us too much data. Pass only one block worth of
|
||||
* uncompressed data to DFLTCC and mask the rest, so that on the next
|
||||
* iteration we start a new block.
|
||||
@@ -737,10 +747,15 @@ __attribute__((constructor)) local void init_globals(void)
|
||||
* compiling with -m31, gcc defaults to ESA mode, however, since the kernel
|
||||
* is 64-bit, it's always z/Architecture mode at runtime.
|
||||
*/
|
||||
- __asm__ volatile(".machinemode push\n"
|
||||
+ __asm__ volatile(
|
||||
+#ifndef __clang__
|
||||
+ ".machinemode push\n"
|
||||
".machinemode zarch\n"
|
||||
+#endif
|
||||
"stfle %[facilities]\n"
|
||||
+#ifndef __clang__
|
||||
".machinemode pop\n"
|
||||
+#endif
|
||||
: [facilities] "=Q" (cpu_facilities)
|
||||
, [r0] "+r" (r0)
|
||||
:
|
||||
@@ -872,6 +887,28 @@ int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy, flush)
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
+int ZLIB_INTERNAL dfltcc_deflate_done(strm, flush)
|
||||
+ z_streamp strm;
|
||||
+ int flush;
|
||||
+{
|
||||
+ deflate_state FAR *state = (deflate_state FAR *)strm->state;
|
||||
+ struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
+ struct dfltcc_param_v0 FAR *param = &dfltcc_state->param;
|
||||
+
|
||||
+ /* When deflate(Z_FULL_FLUSH) is called with small avail_out, it might
|
||||
+ * close the block without resetting the compression state. Detect this
|
||||
+ * situation and return that deflation is not done.
|
||||
+ */
|
||||
+ if (flush == Z_FULL_FLUSH && strm->avail_out == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Return that deflation is not done if DFLTCC is used and either it
|
||||
+ * buffered some data (Continuation Flag is set), or has not written EOBS
|
||||
+ * yet (Block-Continuation Flag is set).
|
||||
+ */
|
||||
+ return !dfltcc_can_deflate(strm) || (!param->cf && !param->bcf);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
Preloading history.
|
||||
*/
|
||||
@@ -925,6 +962,7 @@ int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(strm, dictionary, dict_length)
|
||||
|
||||
append_history(param, state->window, dictionary, dict_length);
|
||||
state->strstart = 1; /* Add FDICT to zlib header */
|
||||
+ state->block_start = state->strstart; /* Make deflate_stored happy */
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
|
||||
index de36784..914daa4 100644
|
||||
--- a/contrib/s390/dfltcc_deflate.h
|
||||
+++ b/contrib/s390/dfltcc_deflate.h
|
||||
@@ -11,6 +11,7 @@ int ZLIB_INTERNAL dfltcc_deflate_params OF((z_streamp strm,
|
||||
int level,
|
||||
int strategy,
|
||||
int *flush));
|
||||
+int ZLIB_INTERNAL dfltcc_deflate_done OF((z_streamp strm, int flush));
|
||||
int ZLIB_INTERNAL dfltcc_deflate_set_dictionary OF((z_streamp strm,
|
||||
const Bytef *dictionary,
|
||||
uInt dict_length));
|
||||
@@ -41,6 +42,7 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dictionary OF((z_streamp strm,
|
||||
if (err == Z_STREAM_ERROR) \
|
||||
return err; \
|
||||
} while (0)
|
||||
+#define DEFLATE_DONE dfltcc_deflate_done
|
||||
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \
|
||||
do { \
|
||||
if (dfltcc_can_deflate((strm))) \
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index d907a1b..085abbe 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -75,6 +75,7 @@ const char deflate_copyright[] =
|
||||
#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
|
||||
#define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
|
||||
#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) do {} while (0)
|
||||
+#define DEFLATE_DONE(strm, flush) 1
|
||||
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen) do {} while (0)
|
||||
#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) 0
|
||||
#define DEFLATE_HOOK(strm, flush, bstate) 0
|
||||
@@ -605,14 +606,15 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||
DEFLATE_PARAMS_HOOK(strm, level, strategy, &hook_flush);
|
||||
func = configuration_table[s->level].func;
|
||||
|
||||
- if ((strategy != s->strategy || func != configuration_table[level].func ||
|
||||
- hook_flush != Z_NO_FLUSH) && s->last_flush != -2) {
|
||||
+ if (((strategy != s->strategy || func != configuration_table[level].func) &&
|
||||
+ s->last_flush != -2) || hook_flush != Z_NO_FLUSH) {
|
||||
/* Flush the last buffer: */
|
||||
- int err = deflate(strm, RANK(hook_flush) > RANK(Z_BLOCK) ?
|
||||
- hook_flush : Z_BLOCK);
|
||||
+ int flush = RANK(hook_flush) > RANK(Z_BLOCK) ? hook_flush : Z_BLOCK;
|
||||
+ int err = deflate(strm, flush);
|
||||
if (err == Z_STREAM_ERROR)
|
||||
return err;
|
||||
- if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
|
||||
+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead ||
|
||||
+ !DEFLATE_DONE(strm, flush))
|
||||
return Z_BUF_ERROR;
|
||||
}
|
||||
if (s->level != level) {
|
||||
diff --git a/test/infcover.c b/test/infcover.c
|
||||
index a34cd17..a208219 100644
|
||||
--- a/test/infcover.c
|
||||
+++ b/test/infcover.c
|
||||
@@ -373,7 +373,7 @@ local void cover_support(void)
|
||||
mem_setup(&strm);
|
||||
strm.avail_in = 0;
|
||||
strm.next_in = Z_NULL;
|
||||
- ret = inflateInit_(&strm, ZLIB_VERSION - 1, (int)sizeof(z_stream));
|
||||
+ ret = inflateInit_(&strm, &ZLIB_VERSION[1], (int)sizeof(z_stream));
|
||||
assert(ret == Z_VERSION_ERROR);
|
||||
mem_done(&strm, "wrong version");
|
||||
|
||||
--
|
||||
2.26.0
|
||||
|
@ -1,93 +0,0 @@
|
||||
Source from https://gitlab.com/redhat/centos-stream/rpms/zlib/-/merge_requests/9
|
||||
Author: Ilya Leoshkevich
|
||||
|
||||
--- a/compress.c
|
||||
+++ b/compress.c
|
||||
@@ -5,9 +5,15 @@
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
-#define ZLIB_INTERNAL
|
||||
+#include "zutil.h"
|
||||
#include "zlib.h"
|
||||
|
||||
+#ifdef DFLTCC
|
||||
+# include "contrib/s390/dfltcc.h"
|
||||
+#else
|
||||
+#define DEFLATE_BOUND_COMPLEN(source_len) 0
|
||||
+#endif
|
||||
+
|
||||
/* ===========================================================================
|
||||
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)
|
||||
uLong sourceLen;
|
||||
{
|
||||
+ uLong complen = DEFLATE_BOUND_COMPLEN(sourceLen);
|
||||
+
|
||||
+ if (complen > 0)
|
||||
+ /* Architecture-specific code provided an upper bound. */
|
||||
+ return complen + ZLIB_WRAPLEN;
|
||||
+
|
||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||
(sourceLen >> 25) + 13;
|
||||
}
|
||||
--- a/contrib/s390/dfltcc.h
|
||||
+++ b/contrib/s390/dfltcc.h
|
||||
@@ -12,6 +12,28 @@ void ZLIB_INTERNAL dfltcc_reset OF((z_streamp strm, uInt size));
|
||||
voidpf ZLIB_INTERNAL dfltcc_alloc_window OF((z_streamp strm, uInt items,
|
||||
uInt size));
|
||||
void ZLIB_INTERNAL dfltcc_free_window OF((z_streamp strm, voidpf w));
|
||||
+#define DFLTCC_BLOCK_HEADER_BITS 3
|
||||
+#define DFLTCC_HLITS_COUNT_BITS 5
|
||||
+#define DFLTCC_HDISTS_COUNT_BITS 5
|
||||
+#define DFLTCC_HCLENS_COUNT_BITS 4
|
||||
+#define DFLTCC_MAX_HCLENS 19
|
||||
+#define DFLTCC_HCLEN_BITS 3
|
||||
+#define DFLTCC_MAX_HLITS 286
|
||||
+#define DFLTCC_MAX_HDISTS 30
|
||||
+#define DFLTCC_MAX_HLIT_HDIST_BITS 7
|
||||
+#define DFLTCC_MAX_SYMBOL_BITS 16
|
||||
+#define DFLTCC_MAX_EOBS_BITS 15
|
||||
+#define DFLTCC_MAX_PADDING_BITS 7
|
||||
+#define DEFLATE_BOUND_COMPLEN(source_len) \
|
||||
+ ((DFLTCC_BLOCK_HEADER_BITS + \
|
||||
+ DFLTCC_HLITS_COUNT_BITS + \
|
||||
+ DFLTCC_HDISTS_COUNT_BITS + \
|
||||
+ DFLTCC_HCLENS_COUNT_BITS + \
|
||||
+ DFLTCC_MAX_HCLENS * DFLTCC_HCLEN_BITS + \
|
||||
+ (DFLTCC_MAX_HLITS + DFLTCC_MAX_HDISTS) * DFLTCC_MAX_HLIT_HDIST_BITS + \
|
||||
+ (source_len) * DFLTCC_MAX_SYMBOL_BITS + \
|
||||
+ DFLTCC_MAX_EOBS_BITS + \
|
||||
+ DFLTCC_MAX_PADDING_BITS) >> 3)
|
||||
int ZLIB_INTERNAL dfltcc_can_inflate OF((z_streamp strm));
|
||||
typedef enum {
|
||||
DFLTCC_INFLATE_CONTINUE,
|
||||
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
|
||||
index 03f7f53..46acfc5 100644
|
||||
--- a/contrib/s390/dfltcc_deflate.h
|
||||
+++ b/contrib/s390/dfltcc_deflate.h
|
||||
@@ -46,8 +46,7 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dictionary OF((z_streamp strm,
|
||||
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \
|
||||
do { \
|
||||
if (dfltcc_can_deflate((strm))) \
|
||||
- (complen) = (3 + 5 + 5 + 4 + 19 * 3 + (286 + 30) * 7 + \
|
||||
- (source_len) * 16 + 15 + 7) >> 3; \
|
||||
+ (complen) = DEFLATE_BOUND_COMPLEN(source_len); \
|
||||
} while (0)
|
||||
#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (dfltcc_can_deflate((strm)))
|
||||
#define DEFLATE_HOOK dfltcc_deflate
|
||||
diff --git a/zutil.h b/zutil.h
|
||||
index 14277bc..cf90e49 100644
|
||||
--- a/zutil.h
|
||||
+++ b/zutil.h
|
||||
@@ -87,6 +87,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
|
||||
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
|
||||
|
||||
+#define ZLIB_WRAPLEN 6 /* zlib format overhead */
|
||||
+
|
||||
/* target dependencies */
|
||||
|
||||
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
@ -1,17 +0,0 @@
|
||||
--- zlib-1.2.11/contrib/s390/dfltcc_deflate.h.old 2023-05-04 09:39:23.423753908 +0000
|
||||
+++ zlib-1.2.11/contrib/s390/dfltcc_deflate.h 2023-05-04 09:39:48.087753908 +0000
|
||||
@@ -45,11 +45,11 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dic
|
||||
#define DEFLATE_DONE dfltcc_deflate_done
|
||||
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \
|
||||
do { \
|
||||
- if (dfltcc_can_deflate((strm))) \
|
||||
+ if (deflateStateCheck((strm)) || dfltcc_can_deflate((strm))) \
|
||||
(complen) = DEFLATE_BOUND_COMPLEN(source_len); \
|
||||
} while (0)
|
||||
#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (dfltcc_can_deflate((strm)))
|
||||
#define DEFLATE_HOOK dfltcc_deflate
|
||||
#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm)))
|
||||
|
||||
-#endif
|
||||
\ No newline at end of file
|
||||
+#endif
|
@ -1,516 +0,0 @@
|
||||
From 608b71008c16ce6fbf2305145c5ffb69cd88ef59 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Dubaj <odubaj@redhat.com>
|
||||
Date: Fri, 7 Aug 2020 07:12:50 +0200
|
||||
Subject: [PATCH] Fix for Z hardware-accelerated deflate for s390x
|
||||
|
||||
---
|
||||
configure | 7 +
|
||||
contrib/s390/dfltcc.c | 244 +++++++++++++++++++++-------------
|
||||
contrib/s390/dfltcc_deflate.h | 10 +-
|
||||
deflate.c | 21 +--
|
||||
4 files changed, 177 insertions(+), 105 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 66caece..bfe4386 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -114,6 +114,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
|
||||
+ echo ' [--dfltcc]' | tee -a configure.log
|
||||
exit 0 ;;
|
||||
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
||||
@@ -137,6 +138,12 @@ case "$1" in
|
||||
-c* | --const) zconst=1; shift ;;
|
||||
-w* | --warn) warn=1; shift ;;
|
||||
-d* | --debug) debug=1; shift ;;
|
||||
+ --dfltcc)
|
||||
+ CFLAGS="$CFLAGS -DDFLTCC"
|
||||
+ OBJC="$OBJC dfltcc.o"
|
||||
+ PIC_OBJC="$PIC_OBJC dfltcc.lo"
|
||||
+ shift
|
||||
+ ;;
|
||||
*)
|
||||
echo "unknown option: $1" | tee -a configure.log
|
||||
echo "$0 --help for help" | tee -a configure.log
|
||||
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
|
||||
index d187796..d88a0d6 100644
|
||||
--- a/contrib/s390/dfltcc.c
|
||||
+++ b/contrib/s390/dfltcc.c
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
/*
|
||||
Use the following commands to build zlib with DFLTCC support:
|
||||
- $ CFLAGS=-DDFLTCC ./configure
|
||||
- $ make OBJA=dfltcc.o PIC_OBJA=dfltcc.lo
|
||||
+ $ ./configure --dfltcc
|
||||
+ $ make
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <ctype.h>
|
||||
+#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@@ -230,31 +231,28 @@ struct dfltcc_state {
|
||||
/*
|
||||
Compress.
|
||||
*/
|
||||
-local inline int dfltcc_are_params_ok(int level,
|
||||
- uInt window_bits,
|
||||
- int strategy,
|
||||
- uLong level_mask);
|
||||
-local inline int dfltcc_are_params_ok(level, window_bits, strategy, level_mask)
|
||||
+local inline int dfltcc_can_deflate_with_params(z_streamp strm,
|
||||
+ int level,
|
||||
+ uInt window_bits,
|
||||
+ int strategy);
|
||||
+local inline int dfltcc_can_deflate_with_params(strm,
|
||||
+ level,
|
||||
+ window_bits,
|
||||
+ strategy)
|
||||
+ z_streamp strm;
|
||||
int level;
|
||||
uInt window_bits;
|
||||
int strategy;
|
||||
- uLong level_mask;
|
||||
-{
|
||||
- return (level_mask & (1 << level)) != 0 &&
|
||||
- (window_bits == HB_BITS) &&
|
||||
- (strategy == Z_FIXED || strategy == Z_DEFAULT_STRATEGY);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-int ZLIB_INTERNAL dfltcc_can_deflate(strm)
|
||||
- z_streamp strm;
|
||||
{
|
||||
deflate_state FAR *state = (deflate_state FAR *)strm->state;
|
||||
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
|
||||
/* Unsupported compression settings */
|
||||
- if (!dfltcc_are_params_ok(state->level, state->w_bits, state->strategy,
|
||||
- dfltcc_state->level_mask))
|
||||
+ if ((dfltcc_state->level_mask & (1 << level)) == 0)
|
||||
+ return 0;
|
||||
+ if (window_bits != HB_BITS)
|
||||
+ return 0;
|
||||
+ if (strategy != Z_FIXED && strategy != Z_DEFAULT_STRATEGY)
|
||||
return 0;
|
||||
|
||||
/* Unsupported hardware */
|
||||
@@ -266,6 +264,17 @@ int ZLIB_INTERNAL dfltcc_can_deflate(strm)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+int ZLIB_INTERNAL dfltcc_can_deflate(strm)
|
||||
+ z_streamp strm;
|
||||
+{
|
||||
+ deflate_state FAR *state = (deflate_state FAR *)strm->state;
|
||||
+
|
||||
+ return dfltcc_can_deflate_with_params(strm,
|
||||
+ state->level,
|
||||
+ state->w_bits,
|
||||
+ state->strategy);
|
||||
+}
|
||||
+
|
||||
local void dfltcc_gdht OF((z_streamp strm));
|
||||
local void dfltcc_gdht(strm)
|
||||
z_streamp strm;
|
||||
@@ -349,22 +358,24 @@ again:
|
||||
soft_bcc = 0;
|
||||
no_flush = flush == Z_NO_FLUSH;
|
||||
|
||||
- /* Trailing empty block. Switch to software, except when Continuation Flag
|
||||
- * is set, which means that DFLTCC has buffered some output in the
|
||||
- * parameter block and needs to be called again in order to flush it.
|
||||
+ /* No input data. Return, except when Continuation Flag is set, which means
|
||||
+ * that DFLTCC has buffered some output in the parameter block and needs to
|
||||
+ * be called again in order to flush it.
|
||||
*/
|
||||
- if (flush == Z_FINISH && strm->avail_in == 0 && !param->cf) {
|
||||
- if (param->bcf) {
|
||||
- /* A block is still open, and the hardware does not support closing
|
||||
- * blocks without adding data. Thus, close it manually.
|
||||
- */
|
||||
+ if (strm->avail_in == 0 && !param->cf) {
|
||||
+ /* A block is still open, and the hardware does not support closing
|
||||
+ * blocks without adding data. Thus, close it manually.
|
||||
+ */
|
||||
+ if (!no_flush && param->bcf) {
|
||||
send_eobs(strm, param);
|
||||
param->bcf = 0;
|
||||
}
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (strm->avail_in == 0 && !param->cf) {
|
||||
+ /* Let one of deflate_* functions write a trailing empty block. */
|
||||
+ if (flush == Z_FINISH)
|
||||
+ return 0;
|
||||
+ /* Clear history. */
|
||||
+ if (flush == Z_FULL_FLUSH)
|
||||
+ param->hl = 0;
|
||||
*result = need_more;
|
||||
return 1;
|
||||
}
|
||||
@@ -418,7 +429,7 @@ again:
|
||||
param->cvt = state->wrap == 2 ? CVT_CRC32 : CVT_ADLER32;
|
||||
if (!no_flush)
|
||||
/* We need to close a block. Always do this in software - when there is
|
||||
- * no input data, the hardware will not nohor BCC. */
|
||||
+ * no input data, the hardware will not honor BCC. */
|
||||
soft_bcc = 1;
|
||||
if (flush == Z_FINISH && !param->bcf)
|
||||
/* We are about to open a BFINAL block, set Block Header Final bit
|
||||
@@ -433,8 +444,8 @@ again:
|
||||
param->sbb = (unsigned int)state->bi_valid;
|
||||
if (param->sbb > 0)
|
||||
*strm->next_out = (Bytef)state->bi_buf;
|
||||
- if (param->hl)
|
||||
- param->nt = 0; /* Honor history */
|
||||
+ /* Honor history and check value */
|
||||
+ param->nt = 0;
|
||||
param->cv = state->wrap == 2 ? ZSWAP32(strm->adler) : strm->adler;
|
||||
|
||||
/* When opening a block, choose a Huffman-Table Type */
|
||||
@@ -642,27 +653,86 @@ int ZLIB_INTERNAL dfltcc_inflate_disable(strm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/*
|
||||
- Memory management.
|
||||
- DFLTCC requires parameter blocks and window to be aligned. zlib allows
|
||||
- users to specify their own allocation functions, so using e.g.
|
||||
- `posix_memalign' is not an option. Thus, we overallocate and take the
|
||||
- aligned portion of the buffer.
|
||||
-*/
|
||||
+local int env_dfltcc_disabled;
|
||||
+local int env_source_date_epoch;
|
||||
+local unsigned long env_level_mask;
|
||||
+local unsigned long env_block_size;
|
||||
+local unsigned long env_block_threshold;
|
||||
+local unsigned long env_dht_threshold;
|
||||
+local unsigned long env_ribm;
|
||||
+local uint64_t cpu_facilities[(DFLTCC_FACILITY / 64) + 1];
|
||||
+local struct dfltcc_qaf_param cpu_af __attribute__((aligned(8)));
|
||||
+
|
||||
local inline int is_dfltcc_enabled OF((void));
|
||||
local inline int is_dfltcc_enabled(void)
|
||||
+{
|
||||
+ if (env_dfltcc_disabled)
|
||||
+ /* User has explicitly disabled DFLTCC. */
|
||||
+ return 0;
|
||||
+
|
||||
+ return is_bit_set((const char *)cpu_facilities, DFLTCC_FACILITY);
|
||||
+}
|
||||
+
|
||||
+local unsigned long xstrtoul OF((const char *s, unsigned long _default));
|
||||
+local unsigned long xstrtoul(s, _default)
|
||||
+ const char *s;
|
||||
+ unsigned long _default;
|
||||
+{
|
||||
+ char *endptr;
|
||||
+ unsigned long result;
|
||||
+
|
||||
+ if (!(s && *s))
|
||||
+ return _default;
|
||||
+ errno = 0;
|
||||
+ result = strtoul(s, &endptr, 0);
|
||||
+ return (errno || *endptr) ? _default : result;
|
||||
+}
|
||||
+
|
||||
+__attribute__((constructor)) local void init_globals OF((void));
|
||||
+__attribute__((constructor)) local void init_globals(void)
|
||||
{
|
||||
const char *env;
|
||||
- uint64_t facilities[(DFLTCC_FACILITY / 64) + 1];
|
||||
register char r0 __asm__("r0");
|
||||
|
||||
env = secure_getenv("DFLTCC");
|
||||
- if (env && !strcmp(env, "0"))
|
||||
- /* User has explicitly disabled DFLTCC. */
|
||||
- return 0;
|
||||
+
|
||||
+
|
||||
+ env_dfltcc_disabled = env && !strcmp(env, "0");
|
||||
+
|
||||
+ env = secure_getenv("SOURCE_DATE_EPOCH");
|
||||
+ env_source_date_epoch = !!env;
|
||||
+
|
||||
+#ifndef DFLTCC_LEVEL_MASK
|
||||
+#define DFLTCC_LEVEL_MASK 0x2
|
||||
+#endif
|
||||
+ env_level_mask = xstrtoul(secure_getenv("DFLTCC_LEVEL_MASK"),
|
||||
+ DFLTCC_LEVEL_MASK);
|
||||
+
|
||||
+#ifndef DFLTCC_BLOCK_SIZE
|
||||
+#define DFLTCC_BLOCK_SIZE 1048576
|
||||
+#endif
|
||||
+ env_block_size = xstrtoul(secure_getenv("DFLTCC_BLOCK_SIZE"),
|
||||
+ DFLTCC_BLOCK_SIZE);
|
||||
|
||||
- memset(facilities, 0, sizeof(facilities));
|
||||
- r0 = sizeof(facilities) / sizeof(facilities[0]) - 1;
|
||||
+#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE
|
||||
+#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
|
||||
+#endif
|
||||
+ env_block_threshold = xstrtoul(secure_getenv("DFLTCC_FIRST_FHT_BLOCK_SIZE"),
|
||||
+ DFLTCC_FIRST_FHT_BLOCK_SIZE);
|
||||
+
|
||||
+#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE
|
||||
+#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096
|
||||
+#endif
|
||||
+ env_dht_threshold = xstrtoul(secure_getenv("DFLTCC_DHT_MIN_SAMPLE_SIZE"),
|
||||
+ DFLTCC_DHT_MIN_SAMPLE_SIZE);
|
||||
+
|
||||
+#ifndef DFLTCC_RIBM
|
||||
+#define DFLTCC_RIBM 0
|
||||
+#endif
|
||||
+ env_ribm = xstrtoul(secure_getenv("DFLTCC_RIBM"), DFLTCC_RIBM);
|
||||
+
|
||||
+ memset(cpu_facilities, 0, sizeof(cpu_facilities));
|
||||
+ r0 = sizeof(cpu_facilities) / sizeof(cpu_facilities[0]) - 1;
|
||||
/* STFLE is supported since z9-109 and only in z/Architecture mode. When
|
||||
* compiling with -m31, gcc defaults to ESA mode, however, since the kernel
|
||||
* is 64-bit, it's always z/Architecture mode at runtime.
|
||||
@@ -671,31 +741,35 @@ local inline int is_dfltcc_enabled(void)
|
||||
".machinemode zarch\n"
|
||||
"stfle %[facilities]\n"
|
||||
".machinemode pop\n"
|
||||
- : [facilities] "=Q" (facilities)
|
||||
+ : [facilities] "=Q" (cpu_facilities)
|
||||
, [r0] "+r" (r0)
|
||||
:
|
||||
: "cc");
|
||||
- return is_bit_set((const char *)facilities, DFLTCC_FACILITY);
|
||||
+ /* Initialize available functions */
|
||||
+ if (is_dfltcc_enabled())
|
||||
+ dfltcc(DFLTCC_QAF, &cpu_af, NULL, NULL, NULL, NULL, NULL);
|
||||
+ else
|
||||
+ memset(&cpu_af, 0, sizeof(cpu_af));
|
||||
}
|
||||
|
||||
+/*
|
||||
+ Memory management.
|
||||
+
|
||||
+ DFLTCC requires parameter blocks and window to be aligned. zlib allows
|
||||
+ users to specify their own allocation functions, so using e.g.
|
||||
+ `posix_memalign' is not an option. Thus, we overallocate and take the
|
||||
+ aligned portion of the buffer.
|
||||
+*/
|
||||
void ZLIB_INTERNAL dfltcc_reset(strm, size)
|
||||
z_streamp strm;
|
||||
uInt size;
|
||||
{
|
||||
struct dfltcc_state *dfltcc_state =
|
||||
(struct dfltcc_state *)((char FAR *)strm->state + ALIGN_UP(size, 8));
|
||||
- struct dfltcc_qaf_param *param =
|
||||
- (struct dfltcc_qaf_param *)&dfltcc_state->param;
|
||||
- const char *s;
|
||||
|
||||
- /* Initialize available functions */
|
||||
- if (is_dfltcc_enabled()) {
|
||||
- dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL);
|
||||
- memmove(&dfltcc_state->af, param, sizeof(dfltcc_state->af));
|
||||
- } else
|
||||
- memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af));
|
||||
+ memcpy(&dfltcc_state->af, &cpu_af, sizeof(dfltcc_state->af));
|
||||
|
||||
- if (secure_getenv("SOURCE_DATE_EPOCH"))
|
||||
+ if (env_source_date_epoch)
|
||||
/* User needs reproducible results, but the output of DFLTCC_CMPR
|
||||
* depends on buffers' page offsets.
|
||||
*/
|
||||
@@ -706,36 +780,11 @@ void ZLIB_INTERNAL dfltcc_reset(strm, size)
|
||||
dfltcc_state->param.nt = 1;
|
||||
|
||||
/* Initialize tuning parameters */
|
||||
-#ifndef DFLTCC_LEVEL_MASK
|
||||
-#define DFLTCC_LEVEL_MASK 0x2
|
||||
-#endif
|
||||
- s = secure_getenv("DFLTCC_LEVEL_MASK");
|
||||
- dfltcc_state->level_mask = (s && *s) ? strtoul(s, NULL, 0) :
|
||||
- DFLTCC_LEVEL_MASK;
|
||||
-#ifndef DFLTCC_BLOCK_SIZE
|
||||
-#define DFLTCC_BLOCK_SIZE 1048576
|
||||
-#endif
|
||||
- s = secure_getenv("DFLTCC_BLOCK_SIZE");
|
||||
- dfltcc_state->block_size = (s && *s) ? strtoul(s, NULL, 0) :
|
||||
- DFLTCC_BLOCK_SIZE;
|
||||
-#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE
|
||||
-#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
|
||||
-#endif
|
||||
- s = secure_getenv("DFLTCC_FIRST_FHT_BLOCK_SIZE");
|
||||
- dfltcc_state->block_threshold = (s && *s) ? strtoul(s, NULL, 0) :
|
||||
- DFLTCC_FIRST_FHT_BLOCK_SIZE;
|
||||
-#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE
|
||||
-#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096
|
||||
-#endif
|
||||
- s = secure_getenv("DFLTCC_DHT_MIN_SAMPLE_SIZE");
|
||||
- dfltcc_state->dht_threshold = (s && *s) ? strtoul(s, NULL, 0) :
|
||||
- DFLTCC_DHT_MIN_SAMPLE_SIZE;
|
||||
-#ifndef DFLTCC_RIBM
|
||||
-#define DFLTCC_RIBM 0
|
||||
-#endif
|
||||
- s = secure_getenv("DFLTCC_RIBM");
|
||||
- dfltcc_state->param.ribm = (s && *s) ? strtoul(s, NULL, 0) :
|
||||
- DFLTCC_RIBM;
|
||||
+ dfltcc_state->level_mask = env_level_mask;
|
||||
+ dfltcc_state->block_size = env_block_size;
|
||||
+ dfltcc_state->block_threshold = env_block_threshold;
|
||||
+ dfltcc_state->dht_threshold = env_dht_threshold;
|
||||
+ dfltcc_state->param.ribm = env_ribm;
|
||||
}
|
||||
|
||||
voidpf ZLIB_INTERNAL dfltcc_alloc_state(strm, items, size)
|
||||
@@ -787,22 +836,26 @@ void ZLIB_INTERNAL dfltcc_free_window(strm, w)
|
||||
|
||||
/*
|
||||
Switching between hardware and software compression.
|
||||
+
|
||||
DFLTCC does not support all zlib settings, e.g. generation of non-compressed
|
||||
blocks or alternative window sizes. When such settings are applied on the
|
||||
fly with deflateParams, we need to convert between hardware and software
|
||||
window formats.
|
||||
*/
|
||||
-int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy)
|
||||
+int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy, flush)
|
||||
z_streamp strm;
|
||||
int level;
|
||||
int strategy;
|
||||
+ int *flush;
|
||||
{
|
||||
deflate_state FAR *state = (deflate_state FAR *)strm->state;
|
||||
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
struct dfltcc_param_v0 FAR *param = &dfltcc_state->param;
|
||||
int could_deflate = dfltcc_can_deflate(strm);
|
||||
- int can_deflate = dfltcc_are_params_ok(level, state->w_bits, strategy,
|
||||
- dfltcc_state->level_mask);
|
||||
+ int can_deflate = dfltcc_can_deflate_with_params(strm,
|
||||
+ level,
|
||||
+ state->w_bits,
|
||||
+ strategy);
|
||||
|
||||
if (can_deflate == could_deflate)
|
||||
/* We continue to work in the same mode - no changes needed */
|
||||
@@ -812,8 +865,11 @@ int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy)
|
||||
/* DFLTCC was not used yet - no changes needed */
|
||||
return Z_OK;
|
||||
|
||||
- /* Switching between hardware and software is not implemented */
|
||||
- return Z_STREAM_ERROR;
|
||||
+ /* For now, do not convert between window formats - simply get rid of the
|
||||
+ * old data instead.
|
||||
+ */
|
||||
+ *flush = Z_FULL_FLUSH;
|
||||
+ return Z_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
|
||||
index a129a91..de36784 100644
|
||||
--- a/contrib/s390/dfltcc_deflate.h
|
||||
+++ b/contrib/s390/dfltcc_deflate.h
|
||||
@@ -9,7 +9,8 @@ int ZLIB_INTERNAL dfltcc_deflate OF((z_streamp strm,
|
||||
block_state *result));
|
||||
int ZLIB_INTERNAL dfltcc_deflate_params OF((z_streamp strm,
|
||||
int level,
|
||||
- int strategy));
|
||||
+ int strategy,
|
||||
+ int *flush));
|
||||
int ZLIB_INTERNAL dfltcc_deflate_set_dictionary OF((z_streamp strm,
|
||||
const Bytef *dictionary,
|
||||
uInt dict_length));
|
||||
@@ -29,11 +30,14 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dictionary OF((z_streamp strm,
|
||||
} while (0)
|
||||
#define DEFLATE_RESET_KEEP_HOOK(strm) \
|
||||
dfltcc_reset((strm), sizeof(deflate_state))
|
||||
-#define DEFLATE_PARAMS_HOOK(strm, level, strategy) \
|
||||
+#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \
|
||||
do { \
|
||||
int err; \
|
||||
\
|
||||
- err = dfltcc_deflate_params((strm), (level), (strategy)); \
|
||||
+ err = dfltcc_deflate_params((strm), \
|
||||
+ (level), \
|
||||
+ (strategy), \
|
||||
+ (hook_flush)); \
|
||||
if (err == Z_STREAM_ERROR) \
|
||||
return err; \
|
||||
} while (0)
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index b17a7dd..a80bd3e 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -74,7 +74,7 @@ const char deflate_copyright[] =
|
||||
#define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
|
||||
#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
|
||||
#define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
|
||||
-#define DEFLATE_PARAMS_HOOK(strm, level, strategy) do {} while (0)
|
||||
+#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) do {} while (0)
|
||||
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen) do {} while (0)
|
||||
#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) 0
|
||||
#define DEFLATE_HOOK(strm, flush, bstate) 0
|
||||
@@ -589,6 +589,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||
{
|
||||
deflate_state *s;
|
||||
compress_func func;
|
||||
+ int hook_flush = Z_NO_FLUSH;
|
||||
|
||||
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||
s = strm->state;
|
||||
@@ -601,13 +602,14 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
|
||||
return Z_STREAM_ERROR;
|
||||
}
|
||||
- DEFLATE_PARAMS_HOOK(strm, level, strategy);
|
||||
+ DEFLATE_PARAMS_HOOK(strm, level, strategy, &hook_flush);
|
||||
func = configuration_table[s->level].func;
|
||||
|
||||
- if ((strategy != s->strategy || func != configuration_table[level].func) &&
|
||||
- s->high_water) {
|
||||
+ if ((strategy != s->strategy || func != configuration_table[level].func ||
|
||||
+ hook_flush != Z_NO_FLUSH) && s->high_water) {
|
||||
/* Flush the last buffer: */
|
||||
- int err = deflate(strm, Z_BLOCK);
|
||||
+ int err = deflate(strm, RANK(hook_flush) > RANK(Z_BLOCK) ?
|
||||
+ hook_flush : Z_BLOCK);
|
||||
if (err == Z_STREAM_ERROR)
|
||||
return err;
|
||||
if (strm->avail_out == 0)
|
||||
@@ -1065,7 +1067,6 @@ int ZEXPORT deflate (strm, flush)
|
||||
}
|
||||
|
||||
if (flush != Z_FINISH) return Z_OK;
|
||||
- if (s->wrap <= 0) return Z_STREAM_END;
|
||||
|
||||
/* Write the trailer */
|
||||
#ifdef GZIP
|
||||
@@ -1081,7 +1082,7 @@ int ZEXPORT deflate (strm, flush)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
- {
|
||||
+ if (s->wrap == 1) {
|
||||
putShortMSB(s, (uInt)(strm->adler >> 16));
|
||||
putShortMSB(s, (uInt)(strm->adler & 0xffff));
|
||||
}
|
||||
@@ -1090,7 +1091,11 @@ int ZEXPORT deflate (strm, flush)
|
||||
* to flush the rest.
|
||||
*/
|
||||
if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
|
||||
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
|
||||
+ if (s->pending == 0) {
|
||||
+ Assert(s->bi_valid == 0, "bi_buf not flushed");
|
||||
+ return Z_STREAM_END;
|
||||
+ }
|
||||
+ return Z_OK;
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
--
|
||||
2.26.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
||||
--- a/contrib/s390/dfltcc.c
|
||||
+++ b/contrib/s390/dfltcc.c
|
||||
@@ -623,7 +623,7 @@
|
||||
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;
|
@ -1,299 +0,0 @@
|
||||
--- a/contrib/s390/dfltcc.c
|
||||
+++ b/contrib/s390/dfltcc.c
|
||||
@@ -539,10 +539,6 @@ int ZLIB_INTERNAL dfltcc_can_inflate(strm)
|
||||
struct inflate_state FAR *state = (struct inflate_state FAR *)strm->state;
|
||||
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
|
||||
- /* Unsupported compression settings */
|
||||
- if (state->wbits != HB_BITS)
|
||||
- return 0;
|
||||
-
|
||||
/* Unsupported hardware */
|
||||
return is_bit_set(dfltcc_state->af.fns, DFLTCC_XPND) &&
|
||||
is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0);
|
||||
@@ -606,8 +602,6 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(strm, flush, ret)
|
||||
/* Translate stream to parameter block */
|
||||
param->cvt = state->flags ? CVT_CRC32 : CVT_ADLER32;
|
||||
param->sbb = state->bits;
|
||||
- param->hl = state->whave; /* Software and hardware history formats match */
|
||||
- param->ho = (state->wnext - state->whave) & ((1 << HB_BITS) - 1);
|
||||
if (param->hl)
|
||||
param->nt = 0; /* Honor history for the first block */
|
||||
param->cv = state->flags ? ZSWAP32(state->check) : state->check;
|
||||
@@ -621,8 +615,6 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(strm, flush, ret)
|
||||
strm->msg = oesc_msg(dfltcc_state->msg, param->oesc);
|
||||
state->last = cc == DFLTCC_CC_OK;
|
||||
state->bits = param->sbb;
|
||||
- state->whave = param->hl;
|
||||
- state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1);
|
||||
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 */
|
||||
@@ -644,11 +636,52 @@ int ZLIB_INTERNAL dfltcc_was_inflate_used(strm)
|
||||
return !param->nt;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ Rotates a circular buffer.
|
||||
+ The implementation is based on https://cplusplus.com/reference/algorithm/rotate/
|
||||
+ */
|
||||
+local void rotate OF((Bytef *start, Bytef *pivot, Bytef *end));
|
||||
+local void rotate(start, pivot, end)
|
||||
+ Bytef *start;
|
||||
+ Bytef *pivot;
|
||||
+ Bytef *end;
|
||||
+{
|
||||
+ Bytef *p = pivot;
|
||||
+ Bytef tmp;
|
||||
+
|
||||
+ while (p != start) {
|
||||
+ tmp = *start;
|
||||
+ *start = *p;
|
||||
+ *p = tmp;
|
||||
+
|
||||
+ start++;
|
||||
+ p++;
|
||||
+
|
||||
+ if (p == end)
|
||||
+ p = pivot;
|
||||
+ else if (start == pivot)
|
||||
+ pivot = p;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#define MIN(x, y) ({ \
|
||||
+ typeof(x) _x = (x); \
|
||||
+ typeof(y) _y = (y); \
|
||||
+ _x < _y ? _x : _y; \
|
||||
+})
|
||||
+
|
||||
+#define MAX(x, y) ({ \
|
||||
+ typeof(x) _x = (x); \
|
||||
+ typeof(y) _y = (y); \
|
||||
+ _x > _y ? _x : _y; \
|
||||
+})
|
||||
+
|
||||
int ZLIB_INTERNAL dfltcc_inflate_disable(strm)
|
||||
z_streamp strm;
|
||||
{
|
||||
struct inflate_state FAR *state = (struct inflate_state FAR *)strm->state;
|
||||
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
+ struct dfltcc_param_v0 *param = &dfltcc_state->param;
|
||||
|
||||
if (!dfltcc_can_inflate(strm))
|
||||
return 0;
|
||||
@@ -660,6 +693,9 @@ int ZLIB_INTERNAL dfltcc_inflate_disable(strm)
|
||||
return 1;
|
||||
/* DFLTCC was not used yet - decompress in software */
|
||||
memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af));
|
||||
+ /* Convert the window from the hardware to the software format */
|
||||
+ rotate(state->window, state->window + param->ho, state->window + HB_SIZE);
|
||||
+ state->whave = state->wnext = MIN(param->hl, state->wsize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -830,9 +866,9 @@ voidpf ZLIB_INTERNAL dfltcc_alloc_window(strm, items, size)
|
||||
voidpf p, w;
|
||||
|
||||
/* To simplify freeing, we store the pointer to the allocated buffer right
|
||||
- * before the window.
|
||||
+ * before the window. Note that DFLTCC always uses HB_SIZE bytes.
|
||||
*/
|
||||
- p = ZALLOC(strm, sizeof(voidpf) + items * size + PAGE_ALIGN,
|
||||
+ p = ZALLOC(strm, sizeof(voidpf) + MAX(items * size, HB_SIZE) + PAGE_ALIGN,
|
||||
sizeof(unsigned char));
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
@@ -841,6 +877,14 @@ voidpf ZLIB_INTERNAL dfltcc_alloc_window(strm, items, size)
|
||||
return w;
|
||||
}
|
||||
|
||||
+void ZLIB_INTERNAL dfltcc_copy_window(dest, src, n)
|
||||
+ void *dest;
|
||||
+ const void *src;
|
||||
+ size_t n;
|
||||
+{
|
||||
+ memcpy(dest, src, MAX(n, HB_SIZE));
|
||||
+}
|
||||
+
|
||||
void ZLIB_INTERNAL dfltcc_free_window(strm, w)
|
||||
z_streamp strm;
|
||||
voidpf w;
|
||||
@@ -951,6 +995,24 @@ local void append_history(param, history, buf, count)
|
||||
}
|
||||
}
|
||||
|
||||
+local void get_history OF((struct dfltcc_param_v0 FAR *param,
|
||||
+ const Bytef *history,
|
||||
+ Bytef *buf));
|
||||
+local void get_history(param, history, buf)
|
||||
+ struct dfltcc_param_v0 FAR *param;
|
||||
+ const Bytef *history;
|
||||
+ Bytef *buf;
|
||||
+{
|
||||
+ if (param->ho + param->hl <= HB_SIZE)
|
||||
+ /* Circular history buffer does not wrap - copy one chunk */
|
||||
+ memcpy(buf, history + param->ho, param->hl);
|
||||
+ else {
|
||||
+ /* Circular history buffer wraps - copy two chunks */
|
||||
+ memcpy(buf, history + param->ho, HB_SIZE - param->ho);
|
||||
+ memcpy(buf + HB_SIZE - param->ho, history, param->ho + param->hl - HB_SIZE);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(strm, dictionary, dict_length)
|
||||
z_streamp strm;
|
||||
const Bytef *dictionary;
|
||||
@@ -975,20 +1037,43 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dictionary(strm, dictionary, dict_length)
|
||||
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
struct dfltcc_param_v0 FAR *param = &dfltcc_state->param;
|
||||
|
||||
- if (dictionary) {
|
||||
- if (param->ho + param->hl <= HB_SIZE)
|
||||
- /* Circular history buffer does not wrap - copy one chunk */
|
||||
- zmemcpy(dictionary, state->window + param->ho, param->hl);
|
||||
- else {
|
||||
- /* Circular history buffer wraps - copy two chunks */
|
||||
- zmemcpy(dictionary,
|
||||
- state->window + param->ho,
|
||||
- HB_SIZE - param->ho);
|
||||
- zmemcpy(dictionary + HB_SIZE - param->ho,
|
||||
- state->window,
|
||||
- param->ho + param->hl - HB_SIZE);
|
||||
- }
|
||||
+ if (dictionary)
|
||||
+ get_history(param, state->window, dictionary);
|
||||
+ if (dict_length)
|
||||
+ *dict_length = param->hl;
|
||||
+ return Z_OK;
|
||||
+}
|
||||
+
|
||||
+int ZLIB_INTERNAL dfltcc_inflate_set_dictionary(strm, dictionary, dict_length)
|
||||
+ z_streamp strm;
|
||||
+ const Bytef *dictionary;
|
||||
+ uInt dict_length;
|
||||
+{
|
||||
+ struct inflate_state *state = (struct inflate_state *)strm->state;
|
||||
+ struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
+ struct dfltcc_param_v0 *param = &dfltcc_state->param;
|
||||
+
|
||||
+ if (inflate_ensure_window(state)) {
|
||||
+ state->mode = MEM;
|
||||
+ return Z_MEM_ERROR;
|
||||
}
|
||||
+
|
||||
+ append_history(param, state->window, dictionary, dict_length);
|
||||
+ state->havedict = 1;
|
||||
+ return Z_OK;
|
||||
+}
|
||||
+
|
||||
+int ZLIB_INTERNAL dfltcc_inflate_get_dictionary(strm, dictionary, dict_length)
|
||||
+ z_streamp strm;
|
||||
+ Bytef *dictionary;
|
||||
+ uInt *dict_length;
|
||||
+{
|
||||
+ struct inflate_state *state = (struct inflate_state *)strm->state;
|
||||
+ struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
|
||||
+ struct dfltcc_param_v0 *param = &dfltcc_state->param;
|
||||
+
|
||||
+ if (dictionary && state->window)
|
||||
+ get_history(param, state->window, dictionary);
|
||||
if (dict_length)
|
||||
*dict_length = param->hl;
|
||||
return Z_OK;
|
||||
--- a/contrib/s390/dfltcc.h
|
||||
+++ b/contrib/s390/dfltcc.h
|
||||
@@ -11,6 +11,8 @@ void ZLIB_INTERNAL dfltcc_copy_state OF((voidpf dst, const voidpf src,
|
||||
void ZLIB_INTERNAL dfltcc_reset OF((z_streamp strm, uInt size));
|
||||
voidpf ZLIB_INTERNAL dfltcc_alloc_window OF((z_streamp strm, uInt items,
|
||||
uInt size));
|
||||
+void ZLIB_INTERNAL dfltcc_copy_window OF((void *dest, const void *src,
|
||||
+ size_t n));
|
||||
void ZLIB_INTERNAL dfltcc_free_window OF((z_streamp strm, voidpf w));
|
||||
#define DFLTCC_BLOCK_HEADER_BITS 3
|
||||
#define DFLTCC_HLITS_COUNT_BITS 5
|
||||
@@ -44,11 +46,18 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate OF((z_streamp strm,
|
||||
int flush, int *ret));
|
||||
int ZLIB_INTERNAL dfltcc_was_inflate_used OF((z_streamp strm));
|
||||
int ZLIB_INTERNAL dfltcc_inflate_disable OF((z_streamp strm));
|
||||
+int ZLIB_INTERNAL dfltcc_inflate_set_dictionary OF((z_streamp strm,
|
||||
+ const Bytef *dictionary,
|
||||
+ uInt dict_length));
|
||||
+int ZLIB_INTERNAL dfltcc_inflate_get_dictionary OF((z_streamp strm,
|
||||
+ Bytef *dictionary,
|
||||
+ uInt* dict_length));
|
||||
|
||||
#define ZALLOC_STATE dfltcc_alloc_state
|
||||
#define ZFREE_STATE ZFREE
|
||||
#define ZCOPY_STATE dfltcc_copy_state
|
||||
#define ZALLOC_WINDOW dfltcc_alloc_window
|
||||
+#define ZCOPY_WINDOW dfltcc_copy_window
|
||||
#define ZFREE_WINDOW dfltcc_free_window
|
||||
#define TRY_FREE_WINDOW dfltcc_free_window
|
||||
#define INFLATE_RESET_KEEP_HOOK(strm) \
|
||||
@@ -77,5 +86,15 @@ int ZLIB_INTERNAL dfltcc_inflate_disable OF((z_streamp strm));
|
||||
do { \
|
||||
if (dfltcc_was_inflate_used((strm))) return Z_STREAM_ERROR; \
|
||||
} while (0)
|
||||
+#define INFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \
|
||||
+ do { \
|
||||
+ if (dfltcc_can_inflate(strm)) \
|
||||
+ return dfltcc_inflate_set_dictionary(strm, dict, dict_len); \
|
||||
+ } while (0)
|
||||
+#define INFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \
|
||||
+ do { \
|
||||
+ if (dfltcc_can_inflate(strm)) \
|
||||
+ return dfltcc_inflate_get_dictionary(strm, dict, dict_len); \
|
||||
+ } while (0)
|
||||
|
||||
#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/inflate.c b/inflate.c
|
||||
index 3750152..a0e2169 100644
|
||||
--- a/inflate.c
|
||||
+++ b/inflate.c
|
||||
@@ -93,6 +93,7 @@
|
||||
#define ZFREE_STATE ZFREE
|
||||
#define ZCOPY_STATE zmemcpy
|
||||
#define ZALLOC_WINDOW ZALLOC
|
||||
+#define ZCOPY_WINDOW zmemcpy
|
||||
#define ZFREE_WINDOW ZFREE
|
||||
#define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
|
||||
#define INFLATE_PRIME_HOOK(strm, bits, value) do {} while (0)
|
||||
@@ -101,6 +102,8 @@
|
||||
#define INFLATE_NEED_UPDATEWINDOW(strm) 1
|
||||
#define INFLATE_MARK_HOOK(strm) do {} while (0)
|
||||
#define INFLATE_SYNC_POINT_HOOK(strm) do {} while (0)
|
||||
+#define INFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
|
||||
+#define INFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef MAKEFIXED
|
||||
@@ -1330,6 +1333,8 @@ uInt *dictLength;
|
||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
|
||||
+ INFLATE_GET_DICTIONARY_HOOK(strm, dictionary, dictLength);
|
||||
+
|
||||
/* copy dictionary */
|
||||
if (state->whave && dictionary != Z_NULL) {
|
||||
zmemcpy(dictionary, state->window + state->wnext,
|
||||
@@ -1365,6 +1370,8 @@ uInt dictLength;
|
||||
return Z_DATA_ERROR;
|
||||
}
|
||||
|
||||
+ INFLATE_SET_DICTIONARY_HOOK(strm, dictionary, dictLength);
|
||||
+
|
||||
/* copy dictionary to window using updatewindow(), which will amend the
|
||||
existing dictionary if appropriate */
|
||||
ret = updatewindow(strm, dictionary + dictLength, dictLength);
|
||||
@@ -1529,8 +1536,7 @@ z_streamp source;
|
||||
}
|
||||
copy->next = copy->codes + (state->next - state->codes);
|
||||
if (window != Z_NULL) {
|
||||
- wsize = 1U << state->wbits;
|
||||
- zmemcpy(window, state->window, wsize);
|
||||
+ ZCOPY_WINDOW(window, state->window, 1U << state->wbits);
|
||||
}
|
||||
copy->window = window;
|
||||
dest->state = (struct internal_state FAR *)copy;
|
@ -1,69 +0,0 @@
|
||||
From 2d80d3f6b52f9fa454c26c89d2d6a1790e1cecb0 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Sat, 21 Jan 2017 01:50:26 -0800
|
||||
Subject: [PATCH] Limit hash table inserts after switch from stored deflate.
|
||||
|
||||
This limits hash table inserts to the available data in the window
|
||||
and to the sliding window size in deflate_stored(). The hash table
|
||||
inserts are deferred until deflateParams() switches to a non-zero
|
||||
compression level.
|
||||
---
|
||||
deflate.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index 20bda4f..d368b25 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -1513,6 +1513,8 @@ local void fill_window(s)
|
||||
s->match_start -= wsize;
|
||||
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
||||
s->block_start -= (long) wsize;
|
||||
+ if (s->insert > s->strstart)
|
||||
+ s->insert = s->strstart;
|
||||
slide_hash(s);
|
||||
more += wsize;
|
||||
}
|
||||
@@ -1742,6 +1744,7 @@ local block_state deflate_stored(s, flush)
|
||||
s->matches = 2; /* clear hash */
|
||||
zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
|
||||
s->strstart = s->w_size;
|
||||
+ s->insert = s->strstart;
|
||||
}
|
||||
else {
|
||||
if (s->window_size - s->strstart <= used) {
|
||||
@@ -1750,12 +1753,14 @@ local block_state deflate_stored(s, flush)
|
||||
zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
||||
if (s->matches < 2)
|
||||
s->matches++; /* add a pending slide_hash() */
|
||||
+ if (s->insert > s->strstart)
|
||||
+ s->insert = s->strstart;
|
||||
}
|
||||
zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
|
||||
s->strstart += used;
|
||||
+ s->insert += MIN(used, s->w_size - s->insert);
|
||||
}
|
||||
s->block_start = s->strstart;
|
||||
- s->insert += MIN(used, s->w_size - s->insert);
|
||||
}
|
||||
if (s->high_water < s->strstart)
|
||||
s->high_water = s->strstart;
|
||||
@@ -1779,12 +1784,15 @@ local block_state deflate_stored(s, flush)
|
||||
if (s->matches < 2)
|
||||
s->matches++; /* add a pending slide_hash() */
|
||||
have += s->w_size; /* more space now */
|
||||
+ if (s->insert > s->strstart)
|
||||
+ s->insert = s->strstart;
|
||||
}
|
||||
if (have > s->strm->avail_in)
|
||||
have = s->strm->avail_in;
|
||||
if (have) {
|
||||
read_buf(s->strm, s->window + s->strstart, have);
|
||||
s->strstart += have;
|
||||
+ s->insert += MIN(have, s->w_size - s->insert);
|
||||
}
|
||||
if (s->high_water < s->strstart)
|
||||
s->high_water = s->strstart;
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,282 +0,0 @@
|
||||
From 14730a26e830eb2b09d1f7097910616f23c1476e Mon Sep 17 00:00:00 2001
|
||||
From: Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
Date: Thu, 2 Feb 2023 19:40:32 +0100
|
||||
Subject: [PATCH] 0001-PATCH-Preparation-for-Power-optimizations.patch
|
||||
|
||||
---
|
||||
CMakeLists.txt | 67 ++++++++++++++++++++++++++++++++++++++++++
|
||||
configure | 66 +++++++++++++++++++++++++++++++++++++++++
|
||||
contrib/README.contrib | 8 +++++
|
||||
contrib/gcc/zifunc.h | 60 +++++++++++++++++++++++++++++++++++++
|
||||
contrib/power/power.h | 4 +++
|
||||
5 files changed, 205 insertions(+)
|
||||
create mode 100644 contrib/gcc/zifunc.h
|
||||
create mode 100644 contrib/power/power.h
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 0fe939d..e762023 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -7,6 +7,7 @@ set(VERSION "1.2.11")
|
||||
|
||||
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()
|
||||
+
|
||||
+ # test to see if we can use a GNU indirect function to detect and load optimized code at runtime
|
||||
+ CHECK_C_SOURCE_COMPILES("
|
||||
+ static int test_ifunc_native(void)
|
||||
+ {
|
||||
+ return 1;
|
||||
+ }
|
||||
+ static int (*(check_ifunc_native(void)))(void)
|
||||
+ {
|
||||
+ return test_ifunc_native;
|
||||
+ }
|
||||
+ int test_ifunc(void) __attribute__ ((ifunc (\"check_ifunc_native\")));
|
||||
+ int main(void)
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ " HAS_C_ATTR_IFUNC)
|
||||
+
|
||||
+ if(HAS_C_ATTR_IFUNC)
|
||||
+ add_definitions(-DHAVE_IFUNC)
|
||||
+ set(ZLIB_PRIVATE_HDRS ${ZLIB_PRIVATE_HDRS} contrib/gcc/zifunc.h)
|
||||
+ endif()
|
||||
+
|
||||
+ if(POWER)
|
||||
+ # Test to see if we can use the optimizations for Power
|
||||
+ CHECK_C_SOURCE_COMPILES("
|
||||
+ #ifndef _ARCH_PPC
|
||||
+ #error \"Target is not Power\"
|
||||
+ #endif
|
||||
+ #ifndef __BUILTIN_CPU_SUPPORTS__
|
||||
+ #error \"Target doesn't support __builtin_cpu_supports()\"
|
||||
+ #endif
|
||||
+ int main() { return 0; }
|
||||
+ " HAS_POWER_SUPPORT)
|
||||
+
|
||||
+ if(HAS_POWER_SUPPORT AND HAS_C_ATTR_IFUNC)
|
||||
+ add_definitions(-DZ_POWER_OPT)
|
||||
+
|
||||
+ set(CMAKE_REQUIRED_FLAGS -mcpu=power8)
|
||||
+ CHECK_C_SOURCE_COMPILES("int main(void){return 0;}" POWER8)
|
||||
+
|
||||
+ if(POWER8)
|
||||
+ add_definitions(-DZ_POWER8)
|
||||
+ set(ZLIB_POWER8 )
|
||||
+
|
||||
+ set_source_files_properties(
|
||||
+ ${ZLIB_POWER8}
|
||||
+ PROPERTIES COMPILE_FLAGS -mcpu=power8)
|
||||
+ endif()
|
||||
+
|
||||
+ set(CMAKE_REQUIRED_FLAGS -mcpu=power9)
|
||||
+ CHECK_C_SOURCE_COMPILES("int main(void){return 0;}" POWER9)
|
||||
+
|
||||
+ if(POWER9)
|
||||
+ add_definitions(-DZ_POWER9)
|
||||
+ set(ZLIB_POWER9 )
|
||||
+
|
||||
+ set_source_files_properties(
|
||||
+ ${ZLIB_POWER9}
|
||||
+ PROPERTIES COMPILE_FLAGS -mcpu=power9)
|
||||
+ endif()
|
||||
+
|
||||
+ set(ZLIB_PRIVATE_HDRS ${ZLIB_PRIVATE_HDRS} contrib/power/power.h)
|
||||
+ set(ZLIB_SRCS ${ZLIB_SRCS} ${ZLIB_POWER8} ${ZLIB_POWER9})
|
||||
+ endif()
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
diff --git a/configure b/configure
|
||||
index d026b35..0538d58 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -846,6 +846,72 @@ else
|
||||
echo "Checking for sys/sdt.h ... No." | tee -a configure.log
|
||||
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 <<EOF
|
||||
+static int test_ifunc_native(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int (*(check_ifunc_native(void)))(void)
|
||||
+{
|
||||
+ return test_ifunc_native;
|
||||
+}
|
||||
+
|
||||
+int test_ifunc(void) __attribute__ ((ifunc ("check_ifunc_native")));
|
||||
+EOF
|
||||
+
|
||||
+if tryboth $CC -c $CFLAGS $test.c; then
|
||||
+ SFLAGS="${SFLAGS} -DHAVE_IFUNC"
|
||||
+ CFLAGS="${CFLAGS} -DHAVE_IFUNC"
|
||||
+ echo "Checking for attribute(ifunc) support... Yes." | tee -a configure.log
|
||||
+else
|
||||
+ echo "Checking for attribute(ifunc) support... No." | tee -a configure.log
|
||||
+fi
|
||||
+
|
||||
+# Test to see if we can use the optimizations for Power
|
||||
+echo >> configure.log
|
||||
+cat > $test.c <<EOF
|
||||
+#ifndef _ARCH_PPC
|
||||
+ #error "Target is not Power"
|
||||
+#endif
|
||||
+#ifndef HAVE_IFUNC
|
||||
+ #error "Target doesn't support ifunc"
|
||||
+#endif
|
||||
+#ifndef __BUILTIN_CPU_SUPPORTS__
|
||||
+ #error "Target doesn't support __builtin_cpu_supports()"
|
||||
+#endif
|
||||
+EOF
|
||||
+
|
||||
+if tryboth $CC -c $CFLAGS $test.c; then
|
||||
+ echo "int main(void){return 0;}" > $test.c
|
||||
+
|
||||
+ if tryboth $CC -c $CFLAGS -mcpu=power8 $test.c; then
|
||||
+ POWER8="-DZ_POWER8"
|
||||
+ PIC_OBJC="${PIC_OBJC}"
|
||||
+ OBJC="${OBJC}"
|
||||
+ echo "Checking for -mcpu=power8 support... Yes." | tee -a configure.log
|
||||
+ else
|
||||
+ echo "Checking for -mcpu=power8 support... No." | tee -a configure.log
|
||||
+ fi
|
||||
+
|
||||
+ if tryboth $CC -c $CFLAGS -mcpu=power9 $test.c; then
|
||||
+ POWER9="-DZ_POWER9"
|
||||
+ PIC_OBJC="${PIC_OBJC}"
|
||||
+ OBJC="${OBJC}"
|
||||
+ echo "Checking for -mcpu=power9 support... Yes." | tee -a configure.log
|
||||
+ else
|
||||
+ echo "Checking for -mcpu=power9 support... No." | tee -a configure.log
|
||||
+ fi
|
||||
+
|
||||
+ SFLAGS="${SFLAGS} ${POWER8} ${POWER9} -DZ_POWER_OPT"
|
||||
+ CFLAGS="${CFLAGS} ${POWER8} ${POWER9} -DZ_POWER_OPT"
|
||||
+ echo "Checking for Power optimizations support... Yes." | tee -a configure.log
|
||||
+else
|
||||
+ echo "Checking for Power optimizations support... No." | tee -a configure.log
|
||||
+fi
|
||||
+
|
||||
# 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 b4d3b18..2a53f90 100644
|
||||
--- a/contrib/README.contrib
|
||||
+++ b/contrib/README.contrib
|
||||
@@ -19,6 +19,10 @@ asm686/ by Brian Raiter <breadbox@muppetlabs.com>
|
||||
blast/ by Mark Adler <madler@alumni.caltech.edu>
|
||||
Decompressor for output of PKWare Data Compression Library (DCL)
|
||||
|
||||
+gcc/ by Matheus Castanho <msc@linux.ibm.com>
|
||||
+ and Rogerio Alves <rcardoso@linux.ibm.com>
|
||||
+ Optimization helpers using GCC-specific extensions
|
||||
+
|
||||
delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
||||
Support for Delphi and C++ Builder
|
||||
|
||||
@@ -63,6 +67,10 @@ minizip/ by Gilles Vollant <info@winimage.com>
|
||||
pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
|
||||
Support for Pascal
|
||||
|
||||
+power/ by Matheus Castanho <msc@linux.ibm.com>
|
||||
+ and Rogerio Alves <rcardoso@linux.ibm.com>
|
||||
+ Optimized functions for Power processors
|
||||
+
|
||||
puff/ by Mark Adler <madler@alumni.caltech.edu>
|
||||
Small, low memory usage inflate. Also serves to provide an
|
||||
unambiguous description of the deflate format.
|
||||
diff --git a/contrib/gcc/zifunc.h b/contrib/gcc/zifunc.h
|
||||
new file mode 100644
|
||||
index 0000000..daf4fe4
|
||||
--- /dev/null
|
||||
+++ b/contrib/gcc/zifunc.h
|
||||
@@ -0,0 +1,60 @@
|
||||
+/* Copyright (C) 2019 Matheus Castanho <msc@linux.ibm.com>, IBM
|
||||
+ * 2019 Rogerio Alves <rogerio.alves@ibm.com>, IBM
|
||||
+ * For conditions of distribution and use, see copyright notice in zlib.h
|
||||
+ */
|
||||
+
|
||||
+#ifndef Z_IFUNC_H_
|
||||
+#define Z_IFUNC_H_
|
||||
+
|
||||
+/* Helpers for arch optimizations */
|
||||
+
|
||||
+#define Z_IFUNC(fname) \
|
||||
+ typeof(fname) fname __attribute__ ((ifunc (#fname "_resolver"))); \
|
||||
+ local typeof(fname) *fname##_resolver(void)
|
||||
+/* This is a helper macro to declare a resolver for an indirect function
|
||||
+ * (ifunc). Let's say you have function
|
||||
+ *
|
||||
+ * int foo (int a);
|
||||
+ *
|
||||
+ * for which you want to provide different implementations, for example:
|
||||
+ *
|
||||
+ * int foo_clever (int a) {
|
||||
+ * ... clever things ...
|
||||
+ * }
|
||||
+ *
|
||||
+ * int foo_smart (int a) {
|
||||
+ * ... smart things ...
|
||||
+ * }
|
||||
+ *
|
||||
+ * You will have to declare foo() as an indirect function and also provide a
|
||||
+ * resolver for it, to choose between foo_clever() and foo_smart() based on
|
||||
+ * some criteria you define (e.g. processor features).
|
||||
+ *
|
||||
+ * Since most likely foo() has a default implementation somewhere in zlib, you
|
||||
+ * may have to rename it so the 'foo' symbol can be used by the ifunc without
|
||||
+ * conflicts.
|
||||
+ *
|
||||
+ * #define foo foo_default
|
||||
+ * int foo (int a) {
|
||||
+ * ...
|
||||
+ * }
|
||||
+ * #undef foo
|
||||
+ *
|
||||
+ * Now you just have to provide a resolver function to choose which function
|
||||
+ * should be used (decided at runtime on the first call to foo()):
|
||||
+ *
|
||||
+ * Z_IFUNC(foo) {
|
||||
+ * if (... some condition ...)
|
||||
+ * return foo_clever;
|
||||
+ *
|
||||
+ * if (... other condition ...)
|
||||
+ * return foo_smart;
|
||||
+ *
|
||||
+ * return foo_default;
|
||||
+ * }
|
||||
+ *
|
||||
+ * All calls to foo() throughout the code can remain untouched, all the magic
|
||||
+ * will be done by the linker using the resolver function.
|
||||
+ */
|
||||
+
|
||||
+#endif /* Z_IFUNC_H_ */
|
||||
diff --git a/contrib/power/power.h b/contrib/power/power.h
|
||||
new file mode 100644
|
||||
index 0000000..b42c7d6
|
||||
--- /dev/null
|
||||
+++ b/contrib/power/power.h
|
||||
@@ -0,0 +1,4 @@
|
||||
+/* Copyright (C) 2019 Matheus Castanho <msc@linux.ibm.com>, IBM
|
||||
+ * 2019 Rogerio Alves <rogerio.alves@ibm.com>, IBM
|
||||
+ * For conditions of distribution and use, see copyright notice in zlib.h
|
||||
+ */
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From f776e1609cc63bf486634ee9bc6226dac2c0d2f3 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Dubaj <odubaj@redhat.com>
|
||||
Date: Tue, 15 Oct 2019 11:27:15 +0200
|
||||
Subject: [PATCH] fixed covscan issues
|
||||
|
||||
---
|
||||
crc32.c | 2 +-
|
||||
deflate.c | 2 +-
|
||||
test/crc32_test.c | 8 ++++----
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index 089285a..9b09718 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -1015,7 +1015,7 @@ int ZEXPORT deflate (strm, flush)
|
||||
*/
|
||||
if (strm->avail_in != 0 || s->lookahead != 0 ||
|
||||
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
|
||||
- block_state bstate;
|
||||
+ block_state bstate = 0;
|
||||
|
||||
bstate = DEFLATE_HOOK(strm, flush, &bstate) ? bstate :
|
||||
s->level == 0 ? deflate_stored(s, flush) :
|
||||
|
@ -1,35 +0,0 @@
|
||||
From eff308af425b67093bab25f80f1ae950166bece1 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <fork@madler.net>
|
||||
Date: Sat, 30 Jul 2022 15:51:11 -0700
|
||||
Subject: [PATCH] Fix a bug when getting a gzip header extra field with
|
||||
inflate().
|
||||
|
||||
If the extra field was larger than the space the user provided with
|
||||
inflateGetHeader(), and if multiple calls of inflate() delivered
|
||||
the extra header data, then there could be a buffer overflow of the
|
||||
provided space. This commit assures that provided space is not
|
||||
exceeded.
|
||||
---
|
||||
inflate.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/inflate.c b/inflate.c
|
||||
index 7be8c63..7a72897 100644
|
||||
--- a/inflate.c
|
||||
+++ b/inflate.c
|
||||
@@ -763,9 +763,10 @@ int flush;
|
||||
copy = state->length;
|
||||
if (copy > have) copy = have;
|
||||
if (copy) {
|
||||
+ len = state->head->extra_len - state->length;
|
||||
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_max) {
|
||||
zmemcpy(state->head->extra + len, next,
|
||||
len + copy > state->head->extra_max ?
|
||||
state->head->extra_max - len : copy);
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <fork@madler.net>
|
||||
Date: Mon, 8 Aug 2022 10:50:09 -0700
|
||||
Subject: [PATCH] Fix extra field processing bug that dereferences NULL
|
||||
state->head.
|
||||
|
||||
The recent commit to fix a gzip header extra field processing bug
|
||||
introduced the new bug fixed here.
|
||||
---
|
||||
inflate.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/inflate.c b/inflate.c
|
||||
index 7a72897..2a3c4fe 100644
|
||||
--- a/inflate.c
|
||||
+++ b/inflate.c
|
||||
@@ -763,10 +763,10 @@ int flush;
|
||||
copy = state->length;
|
||||
if (copy > have) copy = have;
|
||||
if (copy) {
|
||||
- len = state->head->extra_len - state->length;
|
||||
if (state->head != Z_NULL &&
|
||||
state->head->extra != Z_NULL &&
|
||||
- len < state->head->extra_max) {
|
||||
+ (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);
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,45 +0,0 @@
|
||||
Subject: [PATCH] Fixed inflateSyncPoint() bad return value on z15
|
||||
|
||||
---
|
||||
contrib/s390/dfltcc.h | 4 ++++
|
||||
inflate.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/contrib/s390/dfltcc.h b/contrib/s390/dfltcc.h
|
||||
index 574e84c..7960626 100644
|
||||
--- a/contrib/s390/dfltcc.h
|
||||
+++ b/contrib/s390/dfltcc.h
|
||||
@@ -51,5 +51,9 @@ int ZLIB_INTERNAL dfltcc_inflate_disable OF((z_streamp strm));
|
||||
do { \
|
||||
if (dfltcc_was_inflate_used((strm))) return -(1L << 16); \
|
||||
} while (0)
|
||||
+#define INFLATE_SYNC_POINT_HOOK(strm) \
|
||||
+ do { \
|
||||
+ if (dfltcc_was_inflate_used((strm))) return Z_STREAM_ERROR; \
|
||||
+ } while (0)
|
||||
|
||||
#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/inflate.c b/inflate.c
|
||||
index f77c2ae..596034c 100644
|
||||
--- a/inflate.c
|
||||
+++ b/inflate.c
|
||||
@@ -100,6 +100,7 @@
|
||||
#define INFLATE_NEED_CHECKSUM(strm) 1
|
||||
#define INFLATE_NEED_UPDATEWINDOW(strm) 1
|
||||
#define INFLATE_MARK_HOOK(strm) do {} while (0)
|
||||
+#define INFLATE_SYNC_POINT_HOOK(strm) do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef MAKEFIXED
|
||||
@@ -1483,6 +1484,7 @@ z_streamp strm;
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
||||
+ INFLATE_SYNC_POINT_HOOK(strm);
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
return state->mode == STORED && state->bits == 0;
|
||||
}
|
||||
--
|
||||
2.26.0
|
||||
|
@ -1,41 +0,0 @@
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index 1ec7614..b724c8d 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -1233,15 +1233,16 @@ 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.
|
||||
*/
|
||||
-local uInt longest_match(s, cur_match)
|
||||
+local uInt longest_match(s, pcur_match)
|
||||
deflate_state *s;
|
||||
- IPos cur_match; /* current match */
|
||||
+ IPos pcur_match; /* current match */
|
||||
{
|
||||
+ ptrdiff_t cur_match = pcur_match; /* extend to pointer width */
|
||||
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 */
|
||||
+ ptrdiff_t best_len = s->prev_length; /* best match length so far */
|
||||
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)
|
||||
* 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 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_end = scan[best_len];
|
||||
+ register uInt scan_end1 = scan[best_len-1];
|
||||
+ register uInt scan_end = scan[best_len];
|
||||
#endif
|
||||
|
||||
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
@ -1,70 +0,0 @@
|
||||
From d09bb1ab8ef9bb91457c0ead09589e8807489260 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Dubaj <odubaj@redhat.com>
|
||||
Date: Thu, 6 Aug 2020 08:09:53 +0200
|
||||
Subject: [PATCH] Permit a deflateParams() parameter change.
|
||||
|
||||
This change allows a parameter change even if the input data has
|
||||
not all been compressed and copied to the application output
|
||||
buffer, so long as all of the input data has been compressed to
|
||||
the internal pending output buffer. This also allows an immediate
|
||||
deflateParams change so long as there have been no deflate calls
|
||||
since initialization or reset.
|
||||
---
|
||||
deflate.c | 6 +++---
|
||||
zlib.h | 11 ++++++-----
|
||||
2 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/deflate.c b/deflate.c
|
||||
index 9705c1c..f3c9924 100644
|
||||
--- a/deflate.c
|
||||
+++ b/deflate.c
|
||||
@@ -509,7 +509,7 @@ int ZEXPORT deflateResetKeep (strm)
|
||||
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
|
||||
#endif
|
||||
adler32(0L, Z_NULL, 0);
|
||||
- s->last_flush = Z_NO_FLUSH;
|
||||
+ s->last_flush = -2;
|
||||
|
||||
_tr_init(s);
|
||||
|
||||
@@ -606,13 +606,13 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||
func = configuration_table[s->level].func;
|
||||
|
||||
if ((strategy != s->strategy || func != configuration_table[level].func ||
|
||||
- hook_flush != Z_NO_FLUSH) && s->high_water) {
|
||||
+ hook_flush != Z_NO_FLUSH) && s->last_flush != -2) {
|
||||
/* Flush the last buffer: */
|
||||
int err = deflate(strm, RANK(hook_flush) > RANK(Z_BLOCK) ?
|
||||
hook_flush : Z_BLOCK);
|
||||
if (err == Z_STREAM_ERROR)
|
||||
return err;
|
||||
- if (strm->avail_out == 0)
|
||||
+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
|
||||
return Z_BUF_ERROR;
|
||||
}
|
||||
if (s->level != level) {
|
||||
diff --git a/zlib.h b/zlib.h
|
||||
index f09cdaf..001624e 100644
|
||||
--- a/zlib.h
|
||||
+++ b/zlib.h
|
||||
@@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
||||
used to switch between compression and straight copy of the input data, or
|
||||
to switch to a different kind of input data requiring a different strategy.
|
||||
If the compression approach (which is a function of the level) or the
|
||||
- strategy is changed, and if any input has been consumed in a previous
|
||||
- deflate() call, then the input available so far is compressed with the old
|
||||
- level and strategy using deflate(strm, Z_BLOCK). There are three approaches
|
||||
- for the compression levels 0, 1..3, and 4..9 respectively. The new level
|
||||
- and strategy will take effect at the next call of deflate().
|
||||
+ strategy is changed, and if there have been any deflate() calls since the
|
||||
+ state was initialized or reset, then the input available so far is
|
||||
+ compressed with the old level and strategy using deflate(strm, Z_BLOCK).
|
||||
+ There are three approaches for the compression levels 0, 1..3, and 4..9
|
||||
+ respectively. The new level and strategy will take effect at the next call
|
||||
+ of deflate().
|
||||
|
||||
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
|
||||
not have enough output space to complete, then the parameter change will not
|
||||
--
|
||||
2.26.0
|
||||
|
@ -1,428 +0,0 @@
|
||||
From cfbf97cb54a6d06a80e86c85869331e4e2871129 Mon Sep 17 00:00:00 2001
|
||||
From: Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
Date: Thu, 19 Mar 2020 11:52:03 +0100
|
||||
Subject: [PATCH] s390x: vectorize crc32
|
||||
|
||||
Use vector extensions when compiling for s390x and binutils knows
|
||||
about them. At runtime, check whether kernel supports vector
|
||||
extensions (it has to be not just the CPU, but also the kernel) and
|
||||
choose between the regular and the vectorized implementations.
|
||||
---
|
||||
Makefile.in | 9 ++
|
||||
configure | 28 +++++
|
||||
contrib/gcc/zifunc.h | 21 +++-
|
||||
contrib/s390/crc32-vx.c | 195 ++++++++++++++++++++++++++++++++
|
||||
contrib/s390/crc32_z_resolver.c | 41 +++++++
|
||||
crc32.c | 11 +-
|
||||
6 files changed, 301 insertions(+), 4 deletions(-)
|
||||
create mode 100644 contrib/s390/crc32-vx.c
|
||||
create mode 100644 contrib/s390/crc32_z_resolver.c
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index d392616..63f76da 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -29,6 +29,7 @@ LDFLAGS=
|
||||
TEST_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
|
||||
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
|
||||
|
||||
+crc32-vx.o: $(SRCDIR)contrib/s390/crc32-vx.c
|
||||
+ $(CC) $(CFLAGS) $(VGFMAFLAG) $(ZINC) -c -o $@ $(SRCDIR)contrib/s390/crc32-vx.c
|
||||
+
|
||||
deflate.o: $(SRCDIR)deflate.c
|
||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
|
||||
|
||||
@@ -229,6 +233,11 @@ crc32.lo: $(SRCDIR)crc32.c
|
||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
|
||||
-@mv objs/crc32.o $@
|
||||
|
||||
+crc32-vx.lo: $(SRCDIR)contrib/s390/crc32-vx.c
|
||||
+ -@mkdir objs 2>/dev/null || test -d objs
|
||||
+ $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32-vx.o $(SRCDIR)contrib/s390/crc32-vx.c
|
||||
+ -@mv objs/crc32-vx.o $@
|
||||
+
|
||||
crc32_z_power8.lo: $(SRCDIR)contrib/power/crc32_z_power8.c
|
||||
-@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 e37dac8..a4606b8 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -915,6 +915,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
|
||||
+VGFMAFLAG=-march=z13
|
||||
+cat > $test.c <<EOF
|
||||
+#ifndef __s390__
|
||||
+#error
|
||||
+#endif
|
||||
+EOF
|
||||
+if try $CC -c $CFLAGS $VGFMAFLAG $test.c; then
|
||||
+ CFLAGS="$CFLAGS -DHAVE_S390X_VX"
|
||||
+ SFLAGS="$SFLAGS -DHAVE_S390X_VX"
|
||||
+ OBJC="$OBJC crc32-vx.o"
|
||||
+ PIC_OBJC="$PIC_OBJC crc32-vx.lo"
|
||||
+ echo "Checking for s390 vector extensions... Yes." | tee -a configure.log
|
||||
+
|
||||
+ for flag in -mzarch -fzvector; do
|
||||
+ if try $CC -c $CFLAGS $VGFMAFLAG $flag $test.c; then
|
||||
+ VGFMAFLAG="$VGFMAFLAG $flag"
|
||||
+ echo "Checking for $flag... Yes." | tee -a configure.log
|
||||
+ else
|
||||
+ echo "Checking for $flag... No." | tee -a configure.log
|
||||
+ fi
|
||||
+ done
|
||||
+else
|
||||
+ echo "Checking for s390 vector extensions... No." | tee -a configure.log
|
||||
+fi
|
||||
+
|
||||
# show the results in the log
|
||||
echo >> configure.log
|
||||
echo ALL = $ALL >> configure.log
|
||||
@@ -947,6 +973,7 @@ echo mandir = $mandir >> configure.log
|
||||
echo prefix = $prefix >> configure.log
|
||||
echo sharedlibdir = $sharedlibdir >> configure.log
|
||||
echo uname = $uname >> configure.log
|
||||
+echo VGFMAFLAG = $VGFMAFLAG >> configure.log
|
||||
|
||||
# udpate Makefile with the configure results
|
||||
sed < ${SRCDIR}Makefile.in "
|
||||
@@ -956,6 +983,7 @@ sed < ${SRCDIR}Makefile.in "
|
||||
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
||||
/^LDSHARED *=/s#=.*#=$LDSHARED#
|
||||
/^CPP *=/s#=.*#=$CPP#
|
||||
+/^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
|
||||
/^STATICLIB *=/s#=.*#=$STATICLIB#
|
||||
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
||||
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
||||
diff --git a/contrib/gcc/zifunc.h b/contrib/gcc/zifunc.h
|
||||
index daf4fe4..b62379e 100644
|
||||
--- a/contrib/gcc/zifunc.h
|
||||
+++ b/contrib/gcc/zifunc.h
|
||||
@@ -8,9 +8,28 @@
|
||||
|
||||
/* Helpers for arch optimizations */
|
||||
|
||||
+#if defined(__clang__)
|
||||
+#if __has_feature(coverage_sanitizer)
|
||||
+#define Z_IFUNC_NO_SANCOV __attribute__((no_sanitize("coverage")))
|
||||
+#else /* __has_feature(coverage_sanitizer) */
|
||||
+#define Z_IFUNC_NO_SANCOV
|
||||
+#endif /* __has_feature(coverage_sanitizer) */
|
||||
+#else /* __clang__ */
|
||||
+#define Z_IFUNC_NO_SANCOV
|
||||
+#endif /* __clang__ */
|
||||
+
|
||||
+#ifdef __s390__
|
||||
+#define Z_IFUNC_PARAMS unsigned long hwcap
|
||||
+#define Z_IFUNC_ATTRS Z_IFUNC_NO_SANCOV
|
||||
+#else /* __s390__ */
|
||||
+#define Z_IFUNC_PARAMS void
|
||||
+#define Z_IFUNC_ATTRS
|
||||
+#endif /* __s390__ */
|
||||
+
|
||||
#define Z_IFUNC(fname) \
|
||||
typeof(fname) fname __attribute__ ((ifunc (#fname "_resolver"))); \
|
||||
- local typeof(fname) *fname##_resolver(void)
|
||||
+ Z_IFUNC_ATTRS \
|
||||
+ local typeof(fname) *fname##_resolver(Z_IFUNC_PARAMS)
|
||||
/* This is a helper macro to declare a resolver for an indirect function
|
||||
* (ifunc). Let's say you have function
|
||||
*
|
||||
diff --git a/contrib/s390/crc32-vx.c b/contrib/s390/crc32-vx.c
|
||||
new file mode 100644
|
||||
index 0000000..fa5387c
|
||||
--- /dev/null
|
||||
+++ b/contrib/s390/crc32-vx.c
|
||||
@@ -0,0 +1,195 @@
|
||||
+/*
|
||||
+ * Hardware-accelerated CRC-32 variants for Linux on z Systems
|
||||
+ *
|
||||
+ * Use the z/Architecture Vector Extension Facility to accelerate the
|
||||
+ * computing of bitreflected CRC-32 checksums.
|
||||
+ *
|
||||
+ * This CRC-32 implementation algorithm is bitreflected and processes
|
||||
+ * the least-significant bit first (Little-Endian).
|
||||
+ *
|
||||
+ * This code was originally written by Hendrik Brueckner
|
||||
+ * <brueckner@linux.vnet.ibm.com> for use in the Linux kernel and has been
|
||||
+ * relicensed under the zlib license.
|
||||
+ */
|
||||
+
|
||||
+#include "../../zutil.h"
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <vecintrin.h>
|
||||
+
|
||||
+typedef unsigned char uv16qi __attribute__((vector_size(16)));
|
||||
+typedef unsigned int uv4si __attribute__((vector_size(16)));
|
||||
+typedef unsigned long long uv2di __attribute__((vector_size(16)));
|
||||
+
|
||||
+uint32_t crc32_le_vgfm_16(uint32_t crc, const unsigned char *buf, size_t len) {
|
||||
+ /*
|
||||
+ * The CRC-32 constant block contains reduction constants to fold and
|
||||
+ * process particular chunks of the input data stream in parallel.
|
||||
+ *
|
||||
+ * For the CRC-32 variants, the constants are precomputed according to
|
||||
+ * these definitions:
|
||||
+ *
|
||||
+ * R1 = [(x4*128+32 mod P'(x) << 32)]' << 1
|
||||
+ * R2 = [(x4*128-32 mod P'(x) << 32)]' << 1
|
||||
+ * R3 = [(x128+32 mod P'(x) << 32)]' << 1
|
||||
+ * R4 = [(x128-32 mod P'(x) << 32)]' << 1
|
||||
+ * R5 = [(x64 mod P'(x) << 32)]' << 1
|
||||
+ * R6 = [(x32 mod P'(x) << 32)]' << 1
|
||||
+ *
|
||||
+ * The bitreflected Barret reduction constant, u', is defined as
|
||||
+ * the bit reversal of floor(x**64 / P(x)).
|
||||
+ *
|
||||
+ * where P(x) is the polynomial in the normal domain and the P'(x) is the
|
||||
+ * polynomial in the reversed (bitreflected) domain.
|
||||
+ *
|
||||
+ * CRC-32 (IEEE 802.3 Ethernet, ...) polynomials:
|
||||
+ *
|
||||
+ * P(x) = 0x04C11DB7
|
||||
+ * P'(x) = 0xEDB88320
|
||||
+ */
|
||||
+ const uv16qi perm_le2be = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; /* BE->LE mask */
|
||||
+ const uv2di r2r1 = {0x1C6E41596, 0x154442BD4}; /* R2, R1 */
|
||||
+ const uv2di r4r3 = {0x0CCAA009E, 0x1751997D0}; /* R4, R3 */
|
||||
+ const uv2di r5 = {0, 0x163CD6124}; /* R5 */
|
||||
+ const uv2di ru_poly = {0, 0x1F7011641}; /* u' */
|
||||
+ const uv2di crc_poly = {0, 0x1DB710641}; /* P'(x) << 1 */
|
||||
+
|
||||
+ /*
|
||||
+ * Load the initial CRC value.
|
||||
+ *
|
||||
+ * The CRC value is loaded into the rightmost word of the
|
||||
+ * vector register and is later XORed with the LSB portion
|
||||
+ * of the loaded input data.
|
||||
+ */
|
||||
+ uv2di v0 = {0, 0};
|
||||
+ v0 = (uv2di)vec_insert(crc, (uv4si)v0, 3);
|
||||
+
|
||||
+ /* Load a 64-byte data chunk and XOR with CRC */
|
||||
+ uv2di v1 = vec_perm(((uv2di *)buf)[0], ((uv2di *)buf)[0], perm_le2be);
|
||||
+ uv2di v2 = vec_perm(((uv2di *)buf)[1], ((uv2di *)buf)[1], perm_le2be);
|
||||
+ uv2di v3 = vec_perm(((uv2di *)buf)[2], ((uv2di *)buf)[2], perm_le2be);
|
||||
+ uv2di v4 = vec_perm(((uv2di *)buf)[3], ((uv2di *)buf)[3], perm_le2be);
|
||||
+
|
||||
+ v1 ^= v0;
|
||||
+ buf += 64;
|
||||
+ len -= 64;
|
||||
+
|
||||
+ while (len >= 64) {
|
||||
+ /* Load the next 64-byte data chunk */
|
||||
+ uv16qi part1 = vec_perm(((uv16qi *)buf)[0], ((uv16qi *)buf)[0], perm_le2be);
|
||||
+ uv16qi part2 = vec_perm(((uv16qi *)buf)[1], ((uv16qi *)buf)[1], perm_le2be);
|
||||
+ uv16qi part3 = vec_perm(((uv16qi *)buf)[2], ((uv16qi *)buf)[2], perm_le2be);
|
||||
+ uv16qi part4 = vec_perm(((uv16qi *)buf)[3], ((uv16qi *)buf)[3], perm_le2be);
|
||||
+
|
||||
+ /*
|
||||
+ * Perform a GF(2) multiplication of the doublewords in V1 with
|
||||
+ * the R1 and R2 reduction constants in V0. The intermediate result
|
||||
+ * is then folded (accumulated) with the next data chunk in PART1 and
|
||||
+ * stored in V1. Repeat this step for the register contents
|
||||
+ * in V2, V3, and V4 respectively.
|
||||
+ */
|
||||
+ v1 = (uv2di)vec_gfmsum_accum_128(r2r1, v1, part1);
|
||||
+ v2 = (uv2di)vec_gfmsum_accum_128(r2r1, v2, part2);
|
||||
+ v3 = (uv2di)vec_gfmsum_accum_128(r2r1, v3, part3);
|
||||
+ v4 = (uv2di)vec_gfmsum_accum_128(r2r1, v4, part4);
|
||||
+
|
||||
+ buf += 64;
|
||||
+ len -= 64;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Fold V1 to V4 into a single 128-bit value in V1. Multiply V1 with R3
|
||||
+ * and R4 and accumulating the next 128-bit chunk until a single 128-bit
|
||||
+ * value remains.
|
||||
+ */
|
||||
+ v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2);
|
||||
+ v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v3);
|
||||
+ v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v4);
|
||||
+
|
||||
+ while (len >= 16) {
|
||||
+ /* Load next data chunk */
|
||||
+ v2 = vec_perm(*(uv2di *)buf, *(uv2di *)buf, perm_le2be);
|
||||
+
|
||||
+ /* Fold next data chunk */
|
||||
+ v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2);
|
||||
+
|
||||
+ buf += 16;
|
||||
+ len -= 16;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Set up a vector register for byte shifts. The shift value must
|
||||
+ * be loaded in bits 1-4 in byte element 7 of a vector register.
|
||||
+ * Shift by 8 bytes: 0x40
|
||||
+ * Shift by 4 bytes: 0x20
|
||||
+ */
|
||||
+ uv16qi v9 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
+ v9 = vec_insert((unsigned char)0x40, v9, 7);
|
||||
+
|
||||
+ /*
|
||||
+ * Prepare V0 for the next GF(2) multiplication: shift V0 by 8 bytes
|
||||
+ * to move R4 into the rightmost doubleword and set the leftmost
|
||||
+ * doubleword to 0x1.
|
||||
+ */
|
||||
+ v0 = vec_srb(r4r3, (uv2di)v9);
|
||||
+ v0[0] = 1;
|
||||
+
|
||||
+ /*
|
||||
+ * Compute GF(2) product of V1 and V0. The rightmost doubleword
|
||||
+ * of V1 is multiplied with R4. The leftmost doubleword of V1 is
|
||||
+ * multiplied by 0x1 and is then XORed with rightmost product.
|
||||
+ * Implicitly, the intermediate leftmost product becomes padded
|
||||
+ */
|
||||
+ v1 = (uv2di)vec_gfmsum_128(v0, v1);
|
||||
+
|
||||
+ /*
|
||||
+ * Now do the final 32-bit fold by multiplying the rightmost word
|
||||
+ * in V1 with R5 and XOR the result with the remaining bits in V1.
|
||||
+ *
|
||||
+ * To achieve this by a single VGFMAG, right shift V1 by a word
|
||||
+ * and store the result in V2 which is then accumulated. Use the
|
||||
+ * vector unpack instruction to load the rightmost half of the
|
||||
+ * doubleword into the rightmost doubleword element of V1; the other
|
||||
+ * half is loaded in the leftmost doubleword.
|
||||
+ * The vector register with CONST_R5 contains the R5 constant in the
|
||||
+ * rightmost doubleword and the leftmost doubleword is zero to ignore
|
||||
+ * the leftmost product of V1.
|
||||
+ */
|
||||
+ v9 = vec_insert((unsigned char)0x20, v9, 7);
|
||||
+ v2 = vec_srb(v1, (uv2di)v9);
|
||||
+ v1 = vec_unpackl((uv4si)v1); /* Split rightmost doubleword */
|
||||
+ v1 = (uv2di)vec_gfmsum_accum_128(r5, v1, (uv16qi)v2);
|
||||
+
|
||||
+ /*
|
||||
+ * Apply a Barret reduction to compute the final 32-bit CRC value.
|
||||
+ *
|
||||
+ * The input values to the Barret reduction are the degree-63 polynomial
|
||||
+ * in V1 (R(x)), degree-32 generator polynomial, and the reduction
|
||||
+ * constant u. The Barret reduction result is the CRC value of R(x) mod
|
||||
+ * P(x).
|
||||
+ *
|
||||
+ * The Barret reduction algorithm is defined as:
|
||||
+ *
|
||||
+ * 1. T1(x) = floor( R(x) / x^32 ) GF2MUL u
|
||||
+ * 2. T2(x) = floor( T1(x) / x^32 ) GF2MUL P(x)
|
||||
+ * 3. C(x) = R(x) XOR T2(x) mod x^32
|
||||
+ *
|
||||
+ * Note: The leftmost doubleword of vector register containing
|
||||
+ * CONST_RU_POLY is zero and, thus, the intermediate GF(2) product
|
||||
+ * is zero and does not contribute to the final result.
|
||||
+ */
|
||||
+
|
||||
+ /* T1(x) = floor( R(x) / x^32 ) GF2MUL u */
|
||||
+ v2 = vec_unpackl((uv4si)v1);
|
||||
+ v2 = (uv2di)vec_gfmsum_128(ru_poly, v2);
|
||||
+
|
||||
+ /*
|
||||
+ * Compute the GF(2) product of the CRC polynomial with T1(x) in
|
||||
+ * V2 and XOR the intermediate result, T2(x), with the value in V1.
|
||||
+ * The final result is stored in word element 2 of V2.
|
||||
+ */
|
||||
+ v2 = vec_unpackl((uv4si)v2);
|
||||
+ v2 = (uv2di)vec_gfmsum_accum_128(crc_poly, v2, (uv16qi)v1);
|
||||
+
|
||||
+ return ((uv4si)v2)[2];
|
||||
+}
|
||||
diff --git a/contrib/s390/crc32_z_resolver.c b/contrib/s390/crc32_z_resolver.c
|
||||
new file mode 100644
|
||||
index 0000000..9749cab
|
||||
--- /dev/null
|
||||
+++ b/contrib/s390/crc32_z_resolver.c
|
||||
@@ -0,0 +1,41 @@
|
||||
+#include <sys/auxv.h>
|
||||
+#include "../gcc/zifunc.h"
|
||||
+
|
||||
+#define VX_MIN_LEN 64
|
||||
+#define VX_ALIGNMENT 16L
|
||||
+#define VX_ALIGN_MASK (VX_ALIGNMENT - 1)
|
||||
+
|
||||
+unsigned int crc32_le_vgfm_16(unsigned int crc, const unsigned char FAR *buf, z_size_t len);
|
||||
+
|
||||
+local unsigned long s390_crc32_vx(unsigned long crc, const unsigned char FAR *buf, z_size_t len)
|
||||
+{
|
||||
+ uintptr_t prealign, aligned, remaining;
|
||||
+
|
||||
+ if (buf == Z_NULL) return 0UL;
|
||||
+
|
||||
+ if (len < VX_MIN_LEN + VX_ALIGN_MASK)
|
||||
+ return crc32_z_default(crc, buf, len);
|
||||
+
|
||||
+ if ((uintptr_t)buf & VX_ALIGN_MASK) {
|
||||
+ prealign = VX_ALIGNMENT - ((uintptr_t)buf & VX_ALIGN_MASK);
|
||||
+ len -= prealign;
|
||||
+ crc = crc32_z_default(crc, buf, prealign);
|
||||
+ buf += prealign;
|
||||
+ }
|
||||
+ aligned = len & ~VX_ALIGN_MASK;
|
||||
+ remaining = len & VX_ALIGN_MASK;
|
||||
+
|
||||
+ crc = crc32_le_vgfm_16(crc ^ 0xffffffff, buf, (size_t)aligned) ^ 0xffffffff;
|
||||
+
|
||||
+ if (remaining)
|
||||
+ crc = crc32_z_default(crc, buf + aligned, remaining);
|
||||
+
|
||||
+ return crc;
|
||||
+}
|
||||
+
|
||||
+Z_IFUNC(crc32_z)
|
||||
+{
|
||||
+ if (hwcap & HWCAP_S390_VX)
|
||||
+ return s390_crc32_vx;
|
||||
+ return crc32_z_default;
|
||||
+}
|
||||
diff --git a/crc32.c b/crc32.c
|
||||
index b0cda20..379fac3 100644
|
||||
--- a/crc32.c
|
||||
+++ b/crc32.c
|
||||
@@ -199,12 +199,12 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
|
||||
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
|
||||
|
||||
/* ========================================================================= */
|
||||
-#ifdef Z_POWER_OPT
|
||||
+#if defined(Z_POWER_OPT) || defined(HAVE_S390X_VX)
|
||||
/* 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 crc32_z crc32_z_default
|
||||
-#endif /* Z_POWER_OPT */
|
||||
+#endif /* defined(Z_POWER_OPT) || defined(HAVE_S390X_VX) */
|
||||
|
||||
unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||
unsigned long crc;
|
||||
@@ -240,10 +240,15 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||
return crc ^ 0xffffffffUL;
|
||||
}
|
||||
|
||||
-#ifdef Z_POWER_OPT
|
||||
+#if defined(Z_POWER_OPT) || defined(HAVE_S390X_VX)
|
||||
#undef crc32_z
|
||||
+#ifdef Z_POWER_OPT
|
||||
#include "contrib/power/crc32_z_resolver.c"
|
||||
#endif /* Z_POWER_OPT */
|
||||
+#ifdef HAVE_S390X_VX
|
||||
+#include "contrib/s390/crc32_z_resolver.c"
|
||||
+#endif /* HAVE_S390X_VX */
|
||||
+#endif /* defined(Z_POWER_OPT) || defined(HAVE_S390X_VX) */
|
||||
|
||||
/* ========================================================================= */
|
||||
unsigned long ZEXPORT crc32(crc, buf, len)
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,14 +0,0 @@
|
||||
diff -up zlib-1.2.5/contrib/minizip/unzip.c.fixuncrypt zlib-1.2.5/contrib/minizip/unzip.c
|
||||
--- zlib-1.2.5/contrib/minizip/unzip.c.fixuncrypt 2011-11-11 12:13:56.335867758 -0500
|
||||
+++ zlib-1.2.5/contrib/minizip/unzip.c 2011-11-11 12:14:01.747799372 -0500
|
||||
@@ -68,10 +68,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
-#ifndef NOUNCRYPT
|
||||
- #define NOUNCRYPT
|
||||
-#endif
|
||||
-
|
||||
#include "zlib.h"
|
||||
#include "unzip.h"
|
||||
|
645
SPECS/zlib.spec
645
SPECS/zlib.spec
@ -1,645 +0,0 @@
|
||||
# disabled, per rhbz#1609830 and rhbz#1602742
|
||||
%bcond_with minizip
|
||||
|
||||
Name: zlib
|
||||
Version: 1.2.11
|
||||
Release: 25%{?dist}
|
||||
Summary: The compression and decompression library
|
||||
# /contrib/dotzlib/ have Boost license
|
||||
License: zlib and Boost
|
||||
URL: http://www.zlib.net/
|
||||
|
||||
Source: http://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
|
||||
# Backport upstream commit 2d80d3f6b52f9fa454c26c89d2d6a1790e1cecb0
|
||||
# Reason: Fuzzer founds issues with unknown memory access
|
||||
Patch2: zlib-1.2.11-Limit-hash-table-inserts.patch
|
||||
# IBM Z optimalizations
|
||||
Patch3: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-s390x.patch
|
||||
# fix for IBM Z optimalizations
|
||||
Patch6: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-fix.patch
|
||||
# permit a deflateParams() parameter change
|
||||
Patch7: zlib-1.2.11-permit-deflateParams-change.patch
|
||||
# fixed DFLTCC compression level switching issues
|
||||
# enabled HW compression for compression levels 1 through 6
|
||||
Patch8: zlib-1.2.11-IBM-DFLTCC-compression-level-switching-issues.patch
|
||||
# fixed inflateSyncPoint() bad return value on z15
|
||||
Patch9: zlib-1.2.11-inflateSyncPoint-return-value-fix.patch
|
||||
Patch10: zlib-1.2.11-CVE-2018-25032.patch
|
||||
# Fix the compressBound() on z15
|
||||
Patch11: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-compressBound-fix.patch
|
||||
|
||||
# Fix CVE-2022-37434
|
||||
Patch12: zlib-1.2.11-cve-2022-37434.patch
|
||||
Patch13: zlib-1.2.11-cve-2022-37434_2.patch
|
||||
|
||||
# Fix setting strm.adler on z15
|
||||
Patch14: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-strm-adler-fix.patch
|
||||
|
||||
# Optimization for z15
|
||||
Patch15: zlib-1.2.11-IBM-Z-hw-accelrated-inflate-small-window.patch
|
||||
# Optimized crc32 for Power 8+ processors
|
||||
# Source: https://github.com/madler/zlib/pull/750
|
||||
Patch16: zlib-1.2.11-Preparation-for-Power-optimizations.patch
|
||||
Patch17: zlib-1.2.11-Add-Power8-optimized-crc32.patch
|
||||
Patch18: zlib-1.2.11-Fix-clang-s-behavior-on-versions-7.patch
|
||||
|
||||
# Fix for Unnecessary IFUNC resolver for crc32_z
|
||||
# Fix for s390x vectorize CRC32
|
||||
Patch19: zlib-1.2.11-s390x-vectorize-crc32.patch
|
||||
|
||||
# Fix for python3.11 broken libxml2 and lxml on s390x
|
||||
Patch20: zlib-1.2.11-Fix-broken-libxml2-for-python311.patch
|
||||
|
||||
# fixed covscan issues
|
||||
Patch21: zlib-1.2.11-covscan-issues.patch
|
||||
|
||||
# Fix for Crash in zlib deflateBound() function on s390x
|
||||
# Resolves: #2193045
|
||||
Patch22: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-fix-crash-deflateBound.patch
|
||||
|
||||
BuildRequires: automake, autoconf, libtool
|
||||
|
||||
%description
|
||||
Zlib is a general-purpose, patent-free, lossless data compression
|
||||
library which is used by many different programs.
|
||||
|
||||
|
||||
%package devel
|
||||
Summary: Header files and libraries for Zlib development
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
The zlib-devel package contains the header files and libraries needed
|
||||
to develop programs that use the zlib compression and decompression
|
||||
library.
|
||||
|
||||
|
||||
%package static
|
||||
Summary: Static libraries for Zlib development
|
||||
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description static
|
||||
The zlib-static package includes static libraries needed
|
||||
to develop programs that use the zlib compression and
|
||||
decompression library.
|
||||
|
||||
|
||||
%if %{with minizip}
|
||||
%package -n minizip
|
||||
Summary: Library for manipulation with .zip archives
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description -n minizip
|
||||
Minizip is a library for manipulation with files from .zip archives.
|
||||
|
||||
|
||||
%package -n minizip-devel
|
||||
Summary: Development files for the minizip library
|
||||
Requires: minizip%{?_isa} = %{version}-%{release}
|
||||
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description -n minizip-devel
|
||||
This package contains the libraries and header files needed for
|
||||
developing applications which use minizip.
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .fixuncrypt
|
||||
%ifarch s390 s390x
|
||||
%patch1 -p1 -b .optimized-deflate
|
||||
%endif
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
|
||||
|
||||
iconv -f iso-8859-2 -t utf-8 < ChangeLog > ChangeLog.tmp
|
||||
mv ChangeLog.tmp ChangeLog
|
||||
|
||||
|
||||
%build
|
||||
export CFLAGS="$RPM_OPT_FLAGS"
|
||||
%ifarch ppc64
|
||||
CFLAGS+=" -O3"
|
||||
%endif
|
||||
|
||||
export LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now"
|
||||
# no-autotools, %%configure is not compatible
|
||||
%ifarch s390 s390x
|
||||
./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} --dfltcc
|
||||
%else
|
||||
./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix}
|
||||
%endif
|
||||
%make_build
|
||||
|
||||
%if %{with minizip}
|
||||
cd contrib/minizip
|
||||
autoreconf --install
|
||||
%configure --enable-static=no
|
||||
%make_build
|
||||
%endif
|
||||
|
||||
|
||||
%check
|
||||
make test
|
||||
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%if %{with minizip}
|
||||
%make_install -C contrib/minizip
|
||||
# https://github.com/madler/zlib/pull/229
|
||||
rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h
|
||||
%endif
|
||||
|
||||
find $RPM_BUILD_ROOT -name '*.la' -delete
|
||||
|
||||
|
||||
%files
|
||||
%license README
|
||||
%doc ChangeLog FAQ
|
||||
%{_libdir}/libz.so.*
|
||||
|
||||
|
||||
%files devel
|
||||
%doc doc/algorithm.txt test/example.c
|
||||
%{_libdir}/libz.so
|
||||
%{_libdir}/pkgconfig/zlib.pc
|
||||
%{_includedir}/zlib.h
|
||||
%{_includedir}/zconf.h
|
||||
%{_mandir}/man3/zlib.3*
|
||||
|
||||
|
||||
%files static
|
||||
%license README
|
||||
%{_libdir}/libz.a
|
||||
|
||||
|
||||
%if %{with minizip}
|
||||
%files -n minizip
|
||||
%doc contrib/minizip/MiniZip64_info.txt contrib/minizip/MiniZip64_Changes.txt
|
||||
%{_libdir}/libminizip.so.*
|
||||
|
||||
|
||||
%files -n minizip-devel
|
||||
%dir %{_includedir}/minizip
|
||||
%{_includedir}/minizip/*.h
|
||||
%{_libdir}/libminizip.so
|
||||
%{_libdir}/pkgconfig/minizip.pc
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue May 16 2023 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.11-25
|
||||
- Fix the Crash in zlib deflateBound() function on s390x
|
||||
- Resolves: BZ#2193045
|
||||
|
||||
* Tue May 16 2023 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.11-24
|
||||
- Resolve fuzzing issue for unknown memory access
|
||||
|
||||
* Tue May 09 2023 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.11-23
|
||||
- Rebased Power 8 optimization patches
|
||||
- Fix for Unnecessary IFUNC resolver for crc32_z
|
||||
- Fix for python3.11 broken libxml2 and lxml on s390x
|
||||
|
||||
* Tue May 09 2023 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.11-22
|
||||
- Inflate small window optimization for IBM z15 rhbz#2154775
|
||||
|
||||
* Wed Oct 12 2022 Ilya Leoshkevich <iii@linux.ibm.com> - 1.2.11-21
|
||||
- Fix for IBM strm.adler rhbz#2134074
|
||||
|
||||
* Tue Aug 09 2022 Matej Mužila <mmuzila@redhat.com> - 1.2.11-20
|
||||
- Fix heap-based buffer over-read or buffer overflow in inflate in inflate.c
|
||||
- Resolves: CVE-2022-37434
|
||||
|
||||
* Mon May 16 2022 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.11-19
|
||||
- Apply IBM patch for compressBound() function
|
||||
- Source from https://github.com/madler/zlib/issues/410#issuecomment-947212824
|
||||
- Resolves: #2056900
|
||||
|
||||
* Tue Mar 29 2022 Matej Mužila <mmuzila@redhat.com> - 1.2.11-18
|
||||
- Resolves: CVE-2018-25032
|
||||
|
||||
* Mon Jun 15 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-17
|
||||
- Fixed DFLTCC compression level switching issues (#1875492)
|
||||
- Enabled HW compression for compression levels 1 through 6 (#1847438)
|
||||
- Fixed inflateSyncPoint() bad return value on z15 (#1888930)
|
||||
|
||||
* Mon Jun 15 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-16
|
||||
- Permit a deflateParams() parameter change
|
||||
- Another fix for Z hardware-accelerated deflate for s390x architectures
|
||||
- according to previous change by upstream
|
||||
|
||||
* Mon Jun 15 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-15
|
||||
- Another fix for Z hardware-accelerated deflate for s390x architectures
|
||||
|
||||
* Mon May 25 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-14
|
||||
- Fix for Z hardware-accelerated deflate for s390x architectures
|
||||
|
||||
* Tue Oct 29 2019 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-13
|
||||
- Added -DDFLTCC parameter to configure to enable
|
||||
- Z hardware-accelerated deflate for s390x architectures (#1659433)
|
||||
|
||||
* Tue Oct 15 2019 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-12
|
||||
- fixed covscan issues
|
||||
|
||||
* Mon Oct 14 2019 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-11
|
||||
- IBM Z hardware-accelerated deflate for s390x architectures
|
||||
- IBM CRC32 optimalization for POWER 8+ architectures
|
||||
- fixed firefox crash due to zlib (#1741266)
|
||||
- added test for crc32
|
||||
|
||||
* Fri Aug 03 2018 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-10
|
||||
- sync with fedora rawhide
|
||||
|
||||
* Fri May 25 2018 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-9
|
||||
- revert previous aarch64 changes (rhbz#1582444, rhbz#1578798)
|
||||
|
||||
* Mon Apr 30 2018 Peter Robinson <pbrobinson@fedoraproject.org> 1.2.11-8
|
||||
- Optimisations for aarch64
|
||||
- Minor spec cleanups
|
||||
|
||||
* Thu Mar 15 2018 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-7
|
||||
- don't install crypt.h (rhbz#1424609)
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Fri Feb 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.11-5
|
||||
- Switch to %%ldconfig_scriptlets
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Thu Feb 09 2017 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-2
|
||||
- fix s390(x) optimizing patch (FTBFS on s390(x))
|
||||
- simplify ppc64 hack with -O3
|
||||
|
||||
* Mon Jan 30 2017 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-1
|
||||
- latest upstream release (rhbz#1409372)
|
||||
- cleanup rpmlint
|
||||
- revert fix for rhbz#985344
|
||||
- requires with %%_isa tag
|
||||
- drop zlib Z_BLOCK flush patch (rhbz#1417355)
|
||||
|
||||
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Fri Aug 14 2015 Adam Jackson <ajax@redhat.com> 1.2.8-9
|
||||
- Link with -z now for full RELRO
|
||||
|
||||
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Wed Aug 6 2014 Tom Callaway <spot@fedoraproject.org> - 1.2.8-6
|
||||
- fix license handling
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Wed Feb 12 2014 jchaloup <jchaloup@redhat.com> - 1.2.8-4
|
||||
- resolves: #1064213
|
||||
recompiled with -O3 flag for ppc64 arch
|
||||
|
||||
* Sat Aug 10 2013 Kalev Lember <kalevlember@gmail.com> - 1.2.8-3
|
||||
- resolves: #985344
|
||||
add a patch to fix missing minizip include
|
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Fri Jun 7 2013 Peter Schiffer <pschiffe@redhat.com> - 1.2.8-1
|
||||
- resolves: #957680
|
||||
updated to 1.2.8
|
||||
|
||||
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.7-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Thu Oct 4 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-9
|
||||
- updated patch optimizing deflate on s390(x) architectures
|
||||
|
||||
* Wed Aug 29 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-8
|
||||
- related: #832545
|
||||
reverted changes for this bug, static libraries shouldn't be compiled with
|
||||
-fPIC flag
|
||||
|
||||
* Mon Aug 27 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-7
|
||||
- resolves: #844791
|
||||
rank Z_BLOCK flush below Z_PARTIAL_FLUSH only when last flush was Z_BLOCK
|
||||
- done some minor .spec file cleanup
|
||||
|
||||
* Mon Aug 13 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-6
|
||||
- added patch from IBM which optimizes deflate on s390(x) architectures
|
||||
|
||||
* Thu Aug 02 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-5
|
||||
- resolves: #832545
|
||||
recompiled with -fPIC flag
|
||||
|
||||
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.7-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Mon Jun 11 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-3
|
||||
- moved /lib* to /usr/lib*
|
||||
|
||||
* Mon Jun 11 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-2
|
||||
- recompiled with -Wl,-z,relro flags
|
||||
|
||||
* Thu May 10 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-1
|
||||
- resolves: #785726
|
||||
- resolves: #805874
|
||||
update to 1.2.7
|
||||
|
||||
* Tue Jan 10 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.5-6
|
||||
- resolves: #719139
|
||||
Zlib fails to read zip64 files on 64-bit system
|
||||
|
||||
* Fri Nov 11 2011 Tom Callaway <spot@fedoraproject.org> - 1.2.5-5
|
||||
- fix minizip to permit uncrypt when NOUNCRYPT is not defined
|
||||
|
||||
* Wed Apr 6 2011 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.5-4
|
||||
- Resolves: #678603
|
||||
zlib from minizip allowed NULL pointer parameter of function unzGetCurrentFileInfo
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.5-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Wed Jun 16 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.5-2
|
||||
- Resolves: #591317
|
||||
pdfedit fails to compile on i686 with zlib.h errors
|
||||
|
||||
* Thu Apr 22 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.5-1
|
||||
- update to 1.2.5
|
||||
|
||||
* Mon Mar 29 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.4-1
|
||||
- update to 1.2.4
|
||||
use the upstream make/configure files for zlib,
|
||||
change additional makefile/configure file to be used only to minizip
|
||||
add pkgconfig to zlib
|
||||
|
||||
* Mon Mar 8 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.3-25
|
||||
- add Boost license
|
||||
|
||||
* Tue Aug 11 2009 Ville Skyttä <ville.skytta@iki.fi> - 1.2.3-24
|
||||
- Use bzipped upstream tarball.
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-23
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Mar 18 2009 Stepan Kasal <skasal@redhat.com> - 1.2.3-22
|
||||
- fix the libz.so symlink
|
||||
|
||||
* Tue Mar 17 2009 Stepan Kasal <skasal@redhat.com> - 1.2.3-21
|
||||
- consolidate the autoconfiscation patches into one and clean it up
|
||||
- consequently, clean up the %%build and %%install sections
|
||||
- zconf.h includes unistd.h again (#479133)
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-20
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Mon Dec 1 2008 Ivana Varekova <varekova@redhat.com> - 1.2.3-19
|
||||
- fix 473490 - unchecked malloc
|
||||
|
||||
* Wed Feb 13 2008 Ivana Varekova <varekova@redhat.com> - 1.2.3-18
|
||||
- change license tag (226671#c29)
|
||||
|
||||
* Mon Feb 11 2008 Ivana Varekova <varekova@redhat.com> - 1.2.3-17
|
||||
- spec file changes
|
||||
|
||||
* Fri Nov 23 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-16
|
||||
- remove minizip headers to minizip-devel
|
||||
- spec file cleanup
|
||||
- fix minizip.pc file
|
||||
|
||||
* Wed Nov 14 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-15
|
||||
- separate static subpackage
|
||||
|
||||
* Wed Aug 15 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-14
|
||||
- create minizip subpackage
|
||||
|
||||
* Mon May 21 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-13
|
||||
- remove .so,.a
|
||||
|
||||
* Mon May 21 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-12
|
||||
- Resolves #240277
|
||||
Move libz to /lib(64)
|
||||
|
||||
* Mon Apr 23 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-11
|
||||
- Resolves: 237295
|
||||
fix Summary tag
|
||||
|
||||
* Fri Mar 23 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-10
|
||||
- remove zlib .so.* packages to /lib
|
||||
|
||||
* Fri Mar 9 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-9
|
||||
- incorporate package review feedback
|
||||
|
||||
* Wed Feb 21 2007 Adam Tkac <atkac redhat com> - 1.2.3-8
|
||||
- fixed broken version of libz
|
||||
|
||||
* Tue Feb 20 2007 Adam Tkac <atkac redhat com> - 1.2.3-7
|
||||
- building is now automatized
|
||||
- specfile cleanup
|
||||
|
||||
* Tue Feb 20 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-6
|
||||
- remove the compilation part to build section
|
||||
some minor changes
|
||||
|
||||
* Mon Feb 19 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-5
|
||||
- incorporate package review feedback
|
||||
|
||||
* Mon Oct 23 2006 Ivana Varekova <varekova@redhat.com> - 1.2.3-4
|
||||
- fix #209424 - fix libz.a permissions
|
||||
|
||||
* Wed Jul 19 2006 Ivana Varekova <varekova@redhat.com> - 1.2.3-3
|
||||
- add cflags (#199379)
|
||||
|
||||
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.2.3-2
|
||||
- rebuild
|
||||
|
||||
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.2.3-1.2.1
|
||||
- bump again for double-long bug on ppc(64)
|
||||
|
||||
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.2.3-1.2
|
||||
- rebuilt for new gcc4.1 snapshot and glibc changes
|
||||
|
||||
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Wed Aug 24 2005 Florian La Roche <laroche@redhat.com>
|
||||
- update to 1.2.3
|
||||
|
||||
* Fri Jul 22 2005 Ivana Varekova <varekova@redhat.com> 1.2.2.2-5
|
||||
- fix bug 163038 - CAN-2005-1849 - zlib buffer overflow
|
||||
|
||||
* Thu Jul 7 2005 Ivana Varekova <varekova@redhat.com> 1.2.2.2-4
|
||||
- fix bug 162392 - CAN-2005-2096
|
||||
|
||||
* Wed Mar 30 2005 Ivana Varekova <varekova@redhat.com> 1.2.2.2-3
|
||||
- fix bug 122408 - zlib build process runs configure twice
|
||||
|
||||
* Fri Mar 4 2005 Jeff Johnson <jbj@redhat.com> 1.2.2.2-2
|
||||
- rebuild with gcc4.
|
||||
|
||||
* Sat Jan 1 2005 Jeff Johnson <jbj@jbj.org> 1.2.2.2-1
|
||||
- upgrade to 1.2.2.2.
|
||||
|
||||
* Fri Nov 12 2004 Jeff Johnson <jbj@jbj.org> 1.2.2.1-1
|
||||
- upgrade to 1.2.2.1.
|
||||
|
||||
* Sun Sep 12 2004 Jeff Johnson <jbj@redhat.com> 1.2.1.2-1
|
||||
- update to 1.2.1.2 to fix 2 DoS problems (#131385).
|
||||
|
||||
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Tue Mar 02 2004 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Sun Jan 18 2004 Jeff Johnson <jbj@jbj.org> 1.2.1.1-1
|
||||
- upgrade to zlib-1.2.1.1.
|
||||
|
||||
* Sun Nov 30 2003 Florian La Roche <Florian.LaRoche@redhat.de>
|
||||
- update to 1.2.1 release
|
||||
|
||||
* Mon Oct 13 2003 Jeff Johnson <jbj@jbj.org> 1.2.0.7-3
|
||||
- unrevert zlib.h include constants (#106291), rejected upstream.
|
||||
|
||||
* Wed Oct 8 2003 Jeff Johnson <jbj@jbj.org> 1.2.0.7-2
|
||||
- fix: gzeof not set when reading compressed file (#106424).
|
||||
- fix: revert zlib.h include constants for now (#106291).
|
||||
|
||||
* Tue Sep 23 2003 Jeff Johnson <jbj@redhat.com> 1.2.0.7-1
|
||||
- update to 1.2.0.7, penultimate 1.2.1 release candidate.
|
||||
|
||||
* Tue Jul 22 2003 Jeff Johnson <jbj@redhat.com> 1.2.0.3-0.1
|
||||
- update to release candidate.
|
||||
|
||||
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
|
||||
- rebuilt
|
||||
|
||||
* Mon May 19 2003 Jeff Johnson <jbj@redhat.com> 1.1.4-9
|
||||
- rebuild, revert from 1.2.0.1.
|
||||
|
||||
* Mon Feb 24 2003 Jeff Johnson <jbj@redhat.com> 1.1.4-8
|
||||
- fix gzprintf buffer overrun (#84961).
|
||||
|
||||
* Wed Jan 22 2003 Tim Powers <timp@redhat.com> 1.1.4-7
|
||||
- rebuilt
|
||||
|
||||
* Thu Nov 21 2002 Elliot Lee <sopwith@redhat.com> 1.1.4-6
|
||||
- Make ./configure use $CC to ease cross-compilation
|
||||
|
||||
* Tue Nov 12 2002 Jeff Johnson <jbj@redhat.com> 1.1.4-5
|
||||
- rebuild from cvs.
|
||||
|
||||
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
|
||||
- automated rebuild
|
||||
|
||||
* Thu May 23 2002 Tim Powers <timp@redhat.com>
|
||||
- automated rebuild
|
||||
|
||||
* Fri Apr 26 2002 Jakub Jelinek <jakub@redhat.com> 1.1.4-2
|
||||
- remove glibc patch, it is no longer needed (zlib uses gcc -shared
|
||||
as it should)
|
||||
- run tests and only build the package if they succeed
|
||||
|
||||
* Thu Apr 25 2002 Trond Eivind Glomsrød <teg@redhat.com> 1.1.4-1
|
||||
- 1.1.4
|
||||
|
||||
* Wed Jan 30 2002 Trond Eivind Glomsrød <teg@redhat.com> 1.1.3-25.7
|
||||
- Fix double free
|
||||
|
||||
* Sun Aug 26 2001 Trond Eivind Glomsrød <teg@redhat.com> 1.1.3-24
|
||||
- Add example.c and minigzip.c to the doc files, as
|
||||
they are listed as examples in the README (#52574)
|
||||
|
||||
* Mon Jun 18 2001 Trond Eivind Glomsrød <teg@redhat.com>
|
||||
- Updated URL
|
||||
- Add version dependency for zlib-devel
|
||||
- s/Copyright/License/
|
||||
|
||||
* Wed Feb 14 2001 Trond Eivind Glomsrød <teg@redhat.com>
|
||||
- bumped version number - this is the old version without the performance enhancements
|
||||
|
||||
* Fri Sep 15 2000 Florian La Roche <Florian.LaRoche@redhat.de>
|
||||
- add -fPIC for shared libs (patch by Fritz Elfert)
|
||||
|
||||
* Thu Sep 7 2000 Jeff Johnson <jbj@redhat.com>
|
||||
- on 64bit systems, make sure libraries are located correctly.
|
||||
|
||||
* Thu Aug 17 2000 Jeff Johnson <jbj@redhat.com>
|
||||
- summaries from specspo.
|
||||
|
||||
* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
|
||||
- automatic rebuild
|
||||
|
||||
* Sun Jul 02 2000 Trond Eivind Glomsrød <teg@redhat.com>
|
||||
- rebuild
|
||||
|
||||
* Tue Jun 13 2000 Jeff Johnson <jbj@redhat.com>
|
||||
- FHS packaging to build on solaris2.5.1.
|
||||
|
||||
* Wed Jun 07 2000 Trond Eivind Glomsrød <teg@redhat.com>
|
||||
- use %%{_mandir} and %%{_tmppath}
|
||||
|
||||
* Fri May 12 2000 Trond Eivind Glomsrød <teg@redhat.com>
|
||||
- updated URL and source location
|
||||
- moved README to main package
|
||||
|
||||
* Mon Feb 7 2000 Jeff Johnson <jbj@redhat.com>
|
||||
- compress man page.
|
||||
|
||||
* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
|
||||
- auto rebuild in the new build environment (release 5)
|
||||
|
||||
* Wed Sep 09 1998 Cristian Gafton <gafton@redhat.com>
|
||||
- link against glibc
|
||||
|
||||
* Mon Jul 27 1998 Jeff Johnson <jbj@redhat.com>
|
||||
- upgrade to 1.1.3
|
||||
|
||||
* Fri May 08 1998 Prospector System <bugs@redhat.com>
|
||||
- translations modified for de, fr, tr
|
||||
|
||||
* Wed Apr 08 1998 Cristian Gafton <gafton@redhat.com>
|
||||
- upgraded to 1.1.2
|
||||
- buildroot
|
||||
|
||||
* Tue Oct 07 1997 Donnie Barnes <djb@redhat.com>
|
||||
- added URL tag (down at the moment so it may not be correct)
|
||||
- made zlib-devel require zlib
|
||||
|
||||
* Thu Jun 19 1997 Erik Troan <ewt@redhat.com>
|
||||
- built against glibc
|
1
dead.package
Normal file
1
dead.package
Normal file
@ -0,0 +1 @@
|
||||
zlib was removed due to minimization efforts prior to public launch
|
Loading…
Reference in New Issue
Block a user