From 3076dbcb1e924ebdc998ef6a60be709b40897934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Uhliarik?= Date: Fri, 10 Feb 2023 02:28:07 +0100 Subject: [PATCH] enable apr_atomic test again --- apr-1.7.2-disable-atomic-read-test.patch | 14 ------------ apr-1.7.2-r1907541.patch | 29 ++++++++++++++++++++++++ apr.spec | 9 +++++--- 3 files changed, 35 insertions(+), 17 deletions(-) delete mode 100644 apr-1.7.2-disable-atomic-read-test.patch create mode 100644 apr-1.7.2-r1907541.patch diff --git a/apr-1.7.2-disable-atomic-read-test.patch b/apr-1.7.2-disable-atomic-read-test.patch deleted file mode 100644 index 8120448..0000000 --- a/apr-1.7.2-disable-atomic-read-test.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/test/testatomic.c b/test/testatomic.c -index bf388c7..03e1c32 100644 ---- a/test/testatomic.c -+++ b/test/testatomic.c -@@ -953,7 +953,8 @@ abts_suite *testatomic(abts_suite *suite) - abts_run_test(suite, test_atomics_threaded64, NULL); - abts_run_test(suite, test_atomics_busyloop_threaded, NULL); - abts_run_test(suite, test_atomics_busyloop_threaded64, NULL); -- abts_run_test(suite, test_atomics_threaded_setread64, NULL); -+// disable this test due to i686 issues -+// abts_run_test(suite, test_atomics_threaded_setread64, NULL); - #endif - - return suite; diff --git a/apr-1.7.2-r1907541.patch b/apr-1.7.2-r1907541.patch new file mode 100644 index 0000000..b586260 --- /dev/null +++ b/apr-1.7.2-r1907541.patch @@ -0,0 +1,29 @@ +--- a/atomic/unix/mutex64.c 2023/02/09 12:45:02 1907540 ++++ b/atomic/unix/mutex64.c 2023/02/09 13:36:18 1907541 +@@ -96,7 +96,26 @@ + + APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem) + { ++ /* On 32bit CPUs this loads with two instructions (tearing), ++ * so a lock is needed to ensure atomicity. ++ * ++ * APR_SIZEOF_VOIDP is probably not the right check for 32 vs 64 bits CPUs ++ * but it spares an (hardly-)exhaustive list of supported CPUs (and using ++ * assembly). If APR_SIZEOF_VOIDP==4 means that the compiler generates ++ * 32bit instructions (-m32 or whatever) then it's the right check though. ++ */ ++#if APR_SIZEOF_VOIDP >= 8 + return *mem; ++#else ++ apr_uint64_t cur_value; ++ DECLARE_MUTEX_LOCKED(mutex, mem); ++ ++ cur_value = *mem; ++ ++ MUTEX_UNLOCK(mutex); ++ ++ return cur_value; ++#endif + } + + APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val) diff --git a/apr.spec b/apr.spec index fbd7939..305a41e 100644 --- a/apr.spec +++ b/apr.spec @@ -12,7 +12,7 @@ Summary: Apache Portable Runtime library Name: apr Version: 1.7.2 -Release: 1%{?dist} +Release: 2%{?dist} # ASL 2.0: everything # ISC: network_io/apr-1.4.6/network_io/unix/inet_?to?.c # BSD with advertising: strings/apr_snprintf.c, strings/apr_fnmatch.c, @@ -27,7 +27,7 @@ Patch1: apr-1.7.2-libdir.patch Patch2: apr-1.2.7-pkgconf.patch Patch3: apr-1.7.0-deepbind.patch Patch4: apr-1.7.2-autoconf.patch -Patch5: apr-1.7.2-disable-atomic-read-test.patch +Patch5: apr-1.7.2-r1907541.patch BuildRequires: gcc, autoconf, libtool, libuuid-devel, python3 BuildRequires: make @@ -54,7 +54,7 @@ C data structures and routines. %patch2 -p1 -b .pkgconf %patch3 -p1 -b .deepbind %patch4 -p1 -b .autoconf-2-71 -%patch5 -p1 -b .dis-atomic-rd-test +%patch5 -p1 -b .r1907541 %build # regenerate configure script etc. @@ -144,6 +144,9 @@ popd %{_datadir}/aclocal/*.m4 %changelog +* Fri Feb 10 2023 Luboš Uhliarik - 1.7.2-2 +- enable apr_atomic test again + * Thu Feb 02 2023 Luboš Uhliarik - 1.7.2-1 - new version 1.7.2