- Split out configuration to separate package to not mess up the

library packaging and coinstallation

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/zlib?expand=0&rev=60
This commit is contained in:
Tomáš Chvátal 2019-07-17 07:31:40 +00:00 committed by Git OBS Bridge
parent 0fc5ad03cf
commit 992bcd72c2
3 changed files with 55 additions and 30 deletions

View File

@ -1,4 +1,4 @@
From 305e427da7b675b9b9330f2f581c275aa44e7269 Mon Sep 17 00:00:00 2001
From 230b5152e9660eb5e5821c2dbc84ae300dfe1fb1 Mon Sep 17 00:00:00 2001
From: Ilya Leoshkevich <iii@linux.ibm.com>
Date: Wed, 18 Jul 2018 13:14:07 +0200
Subject: [PATCH] Add support for IBM Z hardware-accelerated deflate
@ -94,7 +94,8 @@ updatewindow and made ZLIB_INTERNAL.
---
Makefile.in | 8 +
configure | 13 +
contrib/s390/dfltcc.c | 898 ++++++++++++++++++++++++++++++++++
contrib/README.contrib | 4 +
contrib/s390/dfltcc.c | 904 ++++++++++++++++++++++++++++++++++
contrib/s390/dfltcc.h | 55 +++
contrib/s390/dfltcc_deflate.h | 50 ++
deflate.c | 60 ++-
@ -105,7 +106,7 @@ updatewindow and made ZLIB_INTERNAL.
test/infcover.c | 2 +-
test/minigzip.c | 4 +
trees.c | 13 +-
13 files changed, 1155 insertions(+), 51 deletions(-)
14 files changed, 1165 insertions(+), 51 deletions(-)
create mode 100644 contrib/s390/dfltcc.c
create mode 100644 contrib/s390/dfltcc.h
create mode 100644 contrib/s390/dfltcc_deflate.h
@ -153,11 +154,26 @@ Index: zlib-1.2.11/configure
# show the results in the log
echo >> configure.log
echo ALL = $ALL >> configure.log
Index: zlib-1.2.11/contrib/README.contrib
===================================================================
--- zlib-1.2.11.orig/contrib/README.contrib
+++ zlib-1.2.11/contrib/README.contrib
@@ -67,6 +67,10 @@ puff/ by Mark Adler <madler@alumni
Small, low memory usage inflate. Also serves to provide an
unambiguous description of the deflate format.
+s390/ by Ilya Leoshkevich <iii@linux.ibm.com>
+ Hardware-accelerated deflate on IBM Z with DEFLATE CONVERSION CALL
+ instruction.
+
testzlib/ by Gilles Vollant <info@winimage.com>
Example of the use of zlib
Index: zlib-1.2.11/contrib/s390/dfltcc.c
===================================================================
--- /dev/null
+++ zlib-1.2.11/contrib/s390/dfltcc.c
@@ -0,0 +1,898 @@
@@ -0,0 +1,904 @@
+/* dfltcc.c - SystemZ DEFLATE CONVERSION CALL support. */
+
+/*
@ -180,7 +196,7 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+#include "../../inflate.h"
+#include "dfltcc.h"
+#include "dfltcc_deflate.h"
+#ifdef HAVE_SYS_SDT
+#ifdef HAVE_SYS_SDT_H
+#include <sys/sdt.h>
+#endif
+
@ -230,12 +246,12 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+ int cc;
+
+ __asm__ volatile(
+#ifdef HAVE_SYS_SDT
+#ifdef HAVE_SYS_SDT_H
+ STAP_PROBE_ASM(zlib, dfltcc_entry,
+ STAP_PROBE_ASM_TEMPLATE(5))
+#endif
+ ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n"
+#ifdef HAVE_SYS_SDT
+#ifdef HAVE_SYS_SDT_H
+ STAP_PROBE_ASM(zlib, dfltcc_exit,
+ STAP_PROBE_ASM_TEMPLATE(5))
+#endif
@ -248,7 +264,7 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+ : [r0] "r" (r0)
+ , [r1] "r" (r1)
+ , [hist] "r" (hist)
+#ifdef HAVE_SYS_SDT
+#ifdef HAVE_SYS_SDT_H
+ , STAP_PROBE_ASM_OPERANDS(5, r2, r3, r4, r5, hist)
+#endif
+ : "cc", "memory");
@ -382,7 +398,11 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+ char msg[64]; /* Buffer for strm->msg */
+};
+
+#define GET_DFLTCC_STATE(state) ((struct dfltcc_state FAR *)((state) + 1))
+#define ALIGN_UP(p, size) \
+ (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1))
+
+#define GET_DFLTCC_STATE(state) ((struct dfltcc_state FAR *)( \
+ (char FAR *)(state) + ALIGN_UP(sizeof(*state), 8)))
+
+/*
+ Compress.
@ -812,7 +832,7 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+{
+ const char *env;
+ uint64_t facilities[(DFLTCC_FACILITY / 64) + 1];
+ register int r0 __asm__("r0");
+ register char r0 __asm__("r0");
+
+ env = secure_getenv("DFLTCC");
+ if (env && !strcmp(env, "0"))
@ -821,7 +841,14 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+
+ memset(facilities, 0, sizeof(facilities));
+ r0 = sizeof(facilities) / sizeof(facilities[0]) - 1;
+ __asm__ volatile("stfle %[facilities]\n"
+ /* 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.
+ */
+ __asm__ volatile(".machinemode push\n"
+ ".machinemode zarch\n"
+ "stfle %[facilities]\n"
+ ".machinemode pop\n"
+ : [facilities] "=Q" (facilities)
+ , [r0] "+r" (r0)
+ :
@ -834,7 +861,7 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+ uInt size;
+{
+ struct dfltcc_state *dfltcc_state =
+ (struct dfltcc_state *)((char FAR *)strm->state + size);
+ (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;
@ -894,10 +921,8 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+ uInt items;
+ uInt size;
+{
+ Assert((items * size) % 8 == 0,
+ "The size of zlib state must be a multiple of 8");
+ return ZALLOC(strm,
+ items * size + sizeof(struct dfltcc_state),
+ ALIGN_UP(items * size, 8) + sizeof(struct dfltcc_state),
+ sizeof(unsigned char));
+}
+
@ -906,14 +931,11 @@ Index: zlib-1.2.11/contrib/s390/dfltcc.c
+ const voidpf src;
+ uInt size;
+{
+ zmemcpy(dst, src, size + sizeof(struct dfltcc_state));
+ zmemcpy(dst, src, ALIGN_UP(size, 8) + sizeof(struct dfltcc_state));
+}
+
+static const int PAGE_ALIGN = 0x1000;
+
+#define ALIGN_UP(p, size) \
+ (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1))
+
+voidpf ZLIB_INTERNAL dfltcc_alloc_window(strm, items, size)
+ z_streamp strm;
+ uInt items;

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jul 17 07:26:35 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update the s390 patchset bsc#1137624:
* 410.patch
-------------------------------------------------------------------
Thu Jul 11 16:09:34 UTC 2019 - Bruce Rogers <brogers@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package zlib
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -22,7 +22,7 @@ Release: 0
Summary: Library implementing the DEFLATE compression algorithm
License: Zlib
Group: Development/Libraries/C and C++
Url: http://www.zlib.net/
URL: http://www.zlib.net/
Source0: http://zlib.net/zlib-%{version}.tar.gz
Source1: http://zlib.net/zlib-%{version}.tar.gz.asc
Source2: %{name}.keyring
@ -124,11 +124,12 @@ developing applications which use minizip.
%patch2 -p1
%patch3 -p1
%patch4 -p1
cp %{SOURCE4} .
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
export LDFLAGS="-Wl,-z,relro,-z,now"
%ifarch s390x
%ifarch s390x s390
export CFLAGS="%{optflags} -DDFLTCC"
%define addopts OBJA=dfltcc.o PIC_OBJA=dfltcc.lo
%else
@ -144,7 +145,7 @@ CC="cc" ./configure \
%if %{do_profiling}
make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_generate}" %{addopts}
make check %{?_smp_mflags}
make clean
make %{?_smp_mflags} clean
make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_feedback}" %{addopts}
%else
make %{?_smp_mflags} %{addopts}
@ -189,17 +190,16 @@ find %{buildroot} -type f -name "*.la" -delete -print
%postun -n libminizip1 -p /sbin/ldconfig
%files -n libz1
%defattr(-,root,root)
%license LICENSE
/%{_lib}/libz.so.1.2.*
/%{_lib}/libz.so.1
%files devel
%defattr(-,root,root)
%doc README ChangeLog
%dir %{_docdir}/%{name}/
%dir %{_docdir}/%{name}/examples
%{_docdir}/%{name}/examples/*
%{_mandir}/man3/zlib.3%{ext_man}
%{_mandir}/man3/zlib.3%{?ext_man}
%{_includedir}/zlib.h
%{_includedir}/zconf.h
%{_includedir}/zutil.h
@ -207,19 +207,16 @@ find %{buildroot} -type f -name "*.la" -delete -print
%{_libdir}/pkgconfig/zlib.pc
%files -n libminizip1
%defattr(-,root,root)
%doc contrib/minizip/MiniZip64_info.txt contrib/minizip/MiniZip64_Changes.txt
%{_libdir}/libminizip.so.*
%files -n minizip-devel
%defattr(-,root,root)
%dir %{_includedir}/minizip
%{_includedir}/minizip/*.h
%{_libdir}/libminizip.so
%{_libdir}/pkgconfig/minizip.pc
%files devel-static
%defattr(-,root,root)
%{_libdir}/libz.a
%changelog