diff --git a/zlib-adler-target-attr.patch b/zlib-adler-target-attr.patch new file mode 100644 index 0000000..9ad962f --- /dev/null +++ b/zlib-adler-target-attr.patch @@ -0,0 +1,60 @@ +diff --git a/x86/adler32.c b/x86/adler32.c +index 3f66f54..a941438 100644 +--- a/x86/adler32.c ++++ b/x86/adler32.c +@@ -20,6 +20,19 @@ + # define VEC_NO_GO + #endif + ++#if GCC_VERSION_GE(404) ++#define GCC_ATTR_MMX __attribute__((__target__("mmx"))) ++#define GCC_ATTR_SSE __attribute__((__target__("sse"))) ++#define GCC_ATTR_SSE2 __attribute__((__target__("sse2"))) ++#define GCC_ATTR_SSSE3 __attribute__((__target__("ssse3"))) ++#else ++#define GCC_ATTR_MMX ++#define GCC_ATTR_SSE ++#define GCC_ATTR_SSE2 ++#define GCC_ATTR_SSSE3 ++#endif ++ ++ + /* inline asm, so only on GCC (or compatible) */ + #if defined(__GNUC__) && !defined(VEC_NO_GO) + # define HAVE_ADLER32_VEC +@@ -240,7 +253,7 @@ local noinline const Bytef *adler32_jumped(buf, s1, s2, k) + #endif + + /* ========================================================================= */ +-local uLong adler32_SSSE3(adler, buf, len) ++local GCC_ATTR_SSSE3 uLong adler32_SSSE3(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +@@ -383,7 +396,7 @@ local uLong adler32_SSSE3(adler, buf, len) + } + + /* ========================================================================= */ +-local uLong adler32_SSE2(adler, buf, len) ++local GCC_ATTR_SSE2 uLong adler32_SSE2(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +@@ -604,7 +617,7 @@ local noinline uLong adler32_SSE2_no_oooe(adler, buf, len) + /* + * SSE version to help VIA-C3_2, P2 & P3 + */ +-local uLong adler32_SSE(adler, buf, len) ++local GCC_ATTR_SSE uLong adler32_SSE(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +@@ -740,7 +753,7 @@ local uLong adler32_SSE(adler, buf, len) + * (maybe except AMD K6, Cyrix, Winchip/VIA). + * I did my best to get at least 1 instruction between result -> use + */ +-local uLong adler32_MMX(adler, buf, len) ++local GCC_ATTR_MMX uLong adler32_MMX(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; diff --git a/zlib.changes b/zlib.changes index 9dc11c7..9ddfce0 100644 --- a/zlib.changes +++ b/zlib.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Aug 26 18:36:11 UTC 2011 - crrodriguez@opensuse.org + +- Use __attribute__ target in SSE optimized functions + so the compiler defines __MMX__ __SSE__ etc, this probably + only matters in 32 bit. what version to use is still + determined at runtime by cpuid. + ------------------------------------------------------------------- Mon Jun 27 11:05:47 UTC 2011 - dimstar@opensuse.org diff --git a/zlib.spec b/zlib.spec index 4f6786e..17fe6b3 100644 --- a/zlib.spec +++ b/zlib.spec @@ -43,6 +43,7 @@ Patch1: zlib-lfs.patch Patch2: zlib-parallel.patch # PATCH-FIX-UPSTREAM: bnc#679345 --return NULL checks from 1.2.3 removed by upstream Patch3: zlib-1.2.5-gzopen-null-check.patch +Patch4: zlib-adler-target-attr.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: pkgconfig @@ -88,8 +89,9 @@ libraries. %patch1 %patch2 -p1 %patch3 -p1 - +%patch4 -p1 %build +export LDFLAGS="-Wl,-z,relro,-z,now" # Marcus: breaks example64 in 32bit builds. %define do_profiling 0 %if %{do_profiling} @@ -141,7 +143,7 @@ rm -rf %{buildroot} %files devel %defattr(-,root,root) %doc README ChangeLog -%doc %{_mandir}/man3/zlib.3.gz +%{_mandir}/man3/zlib.3.gz %{_includedir}/zlib.h %{_includedir}/zconf.h %{_includedir}/zutil.h