diff --git a/pcre-8.20-ppcjit.patch b/pcre-8.20-ppcjit.patch new file mode 100644 index 0000000..03155d6 --- /dev/null +++ b/pcre-8.20-ppcjit.patch @@ -0,0 +1,112 @@ +Fix cache-flush on PPC + +From: +r742 | zherczeg | 2011-11-06 09:05:33 +0100 (Ne, 06 lis 2011) | 3 lines + +Fix cache-flush issue on PowerPC, adding some comments and a check for +disabled PCRE_EXTRA_TABLES. + +Fix cache-flush issue on PowerPC (It is still an experimental JIT port). +PCRE_EXTRA_TABLES is not suported by JIT, and should be checked before +calling _pcre_jit_exec. Some extra comments are added. + +Petr Pisar: Changelog removed + +Index: pcre_exec.c +=================================================================== +--- pcre_exec.c (revision 741) ++++ pcre_exec.c (revision 742) +@@ -6011,6 +6011,7 @@ + if (extra_data != NULL + && (extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 + && extra_data->executable_jit != NULL ++ && (extra_data->flags & PCRE_EXTRA_TABLES) == 0 + && (options & ~(PCRE_NO_UTF8_CHECK | PCRE_NOTBOL | PCRE_NOTEOL | + PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART)) == 0) + return _pcre_jit_exec(re, extra_data->executable_jit, subject, length, +Index: sljit/sljitLir.h +=================================================================== +--- sljit/sljitLir.h (revision 741) ++++ sljit/sljitLir.h (revision 742) +@@ -56,6 +56,9 @@ + - mainly position independent code + - Optimizations (perhaps later) + - Only for basic blocks (when no labels inserted between LIR instructions) ++ ++ For valgrind users: ++ - pass --smc-check=all argument to valgrind, since JIT is a "self-modifying code" + */ + + #if !(defined SLJIT_NO_DEFAULT_CONFIG && SLJIT_NO_DEFAULT_CONFIG) +@@ -87,6 +90,7 @@ + + #define SLJIT_UNUSED 0 + ++/* Temporary (scratch) registers may not preserve their values across function calls. */ + #define SLJIT_TEMPORARY_REG1 1 + #define SLJIT_TEMPORARY_REG2 2 + #define SLJIT_TEMPORARY_REG3 3 +@@ -95,6 +99,7 @@ + #define SLJIT_TEMPORARY_EREG1 4 + #define SLJIT_TEMPORARY_EREG2 5 + ++/* General (saved) registers preserve their values across function calls. */ + #define SLJIT_GENERAL_REG1 6 + #define SLJIT_GENERAL_REG2 7 + #define SLJIT_GENERAL_REG3 8 +Index: sljit/sljitNativePPC_common.c +=================================================================== +--- sljit/sljitNativePPC_common.c (revision 741) ++++ sljit/sljitNativePPC_common.c (revision 742) +@@ -37,6 +37,18 @@ + Both for ppc-32 and ppc-64. */ + typedef sljit_ui sljit_ins; + ++static void ppc_cache_flush(sljit_ins *from, sljit_ins *to) ++{ ++ while (from < to) { ++#ifdef __GNUC__ ++ asm volatile ( "icbi 0, %0" : : "r"(from) ); ++#else ++#error "Must implement icbi" ++#endif ++ from++; ++ } ++} ++ + #define TMP_REG1 (SLJIT_NO_REGISTERS + 1) + #define TMP_REG2 (SLJIT_NO_REGISTERS + 2) + #define TMP_REG3 (SLJIT_NO_REGISTERS + 3) +Index: sljit/sljitConfigInternal.h +=================================================================== +--- sljit/sljitConfigInternal.h (revision 741) ++++ sljit/sljitConfigInternal.h (revision 742) +@@ -178,13 +178,23 @@ + + #ifndef SLJIT_CACHE_FLUSH + +-#if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) && !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) +- /* Just call __ARM_NR_cacheflush on Linux. */ ++#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) ++ ++/* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ + #define SLJIT_CACHE_FLUSH(from, to) \ ++ ppc_cache_flush((from), (to)) ++ ++#elif (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) ++ ++/* Not required to implement on archs with unified caches. */ ++#define SLJIT_CACHE_FLUSH(from, to) ++ ++#else ++ ++/* Calls __ARM_NR_cacheflush on ARM-Linux. */ ++#define SLJIT_CACHE_FLUSH(from, to) \ + __clear_cache((char*)(from), (char*)(to)) +-#else +- /* Not required to implement on archs with unified caches. */ +-#define SLJIT_CACHE_FLUSH(from, to) ++ + #endif + + #endif /* !SLJIT_CACHE_FLUSH */ diff --git a/pcre.changes b/pcre.changes index 1226f19..cdafa80 100644 --- a/pcre.changes +++ b/pcre.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Feb 1 10:44:38 UTC 2012 - dvaleev@suse.com + +- Fix cache-flush on PPC + ------------------------------------------------------------------- Wed Nov 16 08:17:40 UTC 2011 - coolo@suse.com diff --git a/pcre.spec b/pcre.spec index 73c46e1..53b0649 100644 --- a/pcre.spec +++ b/pcre.spec @@ -1,7 +1,7 @@ # # spec file for package pcre # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -36,6 +36,8 @@ Source2: baselibs.conf BuildRoot: %{_tmppath}/%{name}-%{version}-build #PATCH-FIX-UPSTREAM crrodriguez@opensuse.org http://bugs.exim.org/show_bug.cgi?id=1173 Patch: pcre-visibility.patch +Patch2: pcre-8.20-ppcjit.patch + %description The PCRE library is a set of functions that implement regular @@ -56,6 +58,7 @@ Obsoletes: pcre-devel-64bit %endif # + %description devel The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics @@ -68,6 +71,7 @@ Group: System/Libraries Provides: %{name} = %{version} Obsoletes: %{name} < %{version} + %description -n libpcre0 The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics @@ -78,6 +82,7 @@ License: BSD3c(or similar) ; Other uncritical OpenSource License Summary: A library for Perl-compatible regular expressions Group: System/Libraries + %description -n libpcreposix0 The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics @@ -88,6 +93,7 @@ License: BSD3c(or similar) ; Other uncritical OpenSource License Summary: A library for Perl-compatible regular expressions Group: System/Libraries + %description -n libpcrecpp0 The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics @@ -101,6 +107,7 @@ Group: System/Libraries BuildArch: noarch %endif + %description doc The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics @@ -112,6 +119,7 @@ Summary: A library for Perl-compatible regular expressions Group: System/Libraries Recommends: %{name}-doc + %description tools The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics @@ -120,6 +128,8 @@ as Perl 5. %prep %setup -q %patch +%patch2 + %build autoreconf -fiv @@ -131,6 +141,7 @@ autoreconf -fiv --enable-unicode-properties %{__make} %{?_smp_mflags} + %install %makeinstall %{__mkdir_p} %{buildroot}/%{_defaultdocdir} @@ -146,6 +157,7 @@ for l in libpcre libpcreposix; do %{__ln_s} -vf /%{_lib}/$ldest %{buildroot}%{_libdir}/$l.so done + %check export LANG=POSIX %ifarch %arm @@ -154,34 +166,45 @@ make test || echo make test failed make test %endif + %clean %{__rm} -rf %{buildroot} + %post -n libpcre0 -p /sbin/ldconfig + %postun -n libpcre0 -p /sbin/ldconfig + %post -n libpcrecpp0 -p /sbin/ldconfig + %postun -n libpcrecpp0 -p /sbin/ldconfig + %post -n libpcreposix0 -p /sbin/ldconfig + %postun -n libpcreposix0 -p /sbin/ldconfig + %files -n libpcre0 %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog LICENCE NEWS README /%{_lib}/libpcre.so.* + %files -n libpcrecpp0 %defattr(-,root,root) %{_libdir}/libpcrecpp.so.* + %files -n libpcreposix0 %defattr(-,root,root) /%{_lib}/libpcreposix.so.* + %files tools %defattr(-,root,root) %{_bindir}/pcregrep @@ -189,10 +212,12 @@ make test %{_mandir}/man1/pcregrep.* %{_mandir}/man1/pcretest.* + %files doc %defattr(-,root,root) %doc doc/html doc/*.txt + %files devel %defattr(-,root,root) %{_bindir}/pcre-config @@ -204,4 +229,6 @@ make test %{_mandir}/man1/pcre-config.* %{_mandir}/man3/*.gz + + %changelog