Bug#978018: libapr1: Please add 64-bit atomics workaround for m68k and sh4

2020-12-24 Thread John Paul Adrian Glaubitz
Control: tags -1 +patch

Attaching a patch. Please include sh3 in this change as well.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

diff -Nru apr.old/apr-1.7.0/debian/changelog apr/apr-1.7.0/debian/changelog
--- apr.old/apr-1.7.0/debian/changelog	2020-11-21 21:06:09.0 +0100
+++ apr/apr-1.7.0/debian/changelog	2020-12-24 18:01:25.611495190 +0100
@@ -1,3 +1,9 @@
+apr (1.7.0-4+ports) unstable; urgency=medium
+
+  * Fix atomics for m68k, sh3 and sh4.
+
+ -- John Paul Adrian Glaubitz   Thu, 24 Dec 2020 18:01:15 +0100
+
 apr (1.7.0-4) unstable; urgency=low
 
   [ Debian Janitor ]
diff -Nru apr.old/apr-1.7.0/debian/patches/generic-64bit-atomics.patch apr/apr-1.7.0/debian/patches/generic-64bit-atomics.patch
--- apr.old/apr-1.7.0/debian/patches/generic-64bit-atomics.patch	2020-08-30 21:07:53.0 +0200
+++ apr/apr-1.7.0/debian/patches/generic-64bit-atomics.patch	2020-12-24 17:44:40.797741482 +0100
@@ -1,20 +1,24 @@
 # quick and dirty fix for FTBFS on mipsel
 # There should be a proper configure check, see 
 # https://bz.apache.org/bugzilla/show_bug.cgi?id=63566
 apr.orig/include/arch/unix/apr_arch_atomic.h
-+++ apr/include/arch/unix/apr_arch_atomic.h
+Index: apr-1.7.0/include/arch/unix/apr_arch_atomic.h
+===
+--- apr-1.7.0.orig/include/arch/unix/apr_arch_atomic.h
 apr-1.7.0/include/arch/unix/apr_arch_atomic.h
 @@ -26,6 +26,9 @@
  /* noop */
  #elif HAVE_ATOMIC_BUILTINS
  #   define USE_ATOMICS_BUILTINS
-+#   if (__INTPTR_WIDTH__ == 32) && ( defined(__MIPSEL__) || defined(__powerpc__) )
++#   if (__INTPTR_WIDTH__ == 32) && ( defined(__MIPSEL__) || defined(__powerpc__) ) || defined(__m68k__) || defined(__sh__)
 +#   define NEED_ATOMICS_GENERIC64
 +#   endif
  #elif defined(SOLARIS2) && SOLARIS2 >= 10
  #   define USE_ATOMICS_SOLARIS
  #   define NEED_ATOMICS_GENERIC64
 apr.orig/atomic/unix/builtins64.c
-+++ apr/atomic/unix/builtins64.c
+Index: apr-1.7.0/atomic/unix/builtins64.c
+===
+--- apr-1.7.0.orig/atomic/unix/builtins64.c
 apr-1.7.0/atomic/unix/builtins64.c
 @@ -16,7 +16,7 @@
  
  #include "apr_arch_atomic.h"
@@ -24,8 +28,10 @@
  
  APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
  {
 apr.orig/atomic/unix/builtins.c
-+++ apr/atomic/unix/builtins.c
+Index: apr-1.7.0/atomic/unix/builtins.c
+===
+--- apr-1.7.0.orig/atomic/unix/builtins.c
 apr-1.7.0/atomic/unix/builtins.c
 @@ -20,7 +20,11 @@
  
  APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
diff -Nru apr.old/apr-1.7.0/debian/patches/generic-64bit-atomics.patch~ apr/apr-1.7.0/debian/patches/generic-64bit-atomics.patch~
--- apr.old/apr-1.7.0/debian/patches/generic-64bit-atomics.patch~	1970-01-01 01:00:00.0 +0100
+++ apr/apr-1.7.0/debian/patches/generic-64bit-atomics.patch~	2020-08-30 21:07:53.0 +0200
@@ -0,0 +1,40 @@
+# quick and dirty fix for FTBFS on mipsel
+# There should be a proper configure check, see 
+# https://bz.apache.org/bugzilla/show_bug.cgi?id=63566
+--- apr.orig/include/arch/unix/apr_arch_atomic.h
 apr/include/arch/unix/apr_arch_atomic.h
+@@ -26,6 +26,9 @@
+ /* noop */
+ #elif HAVE_ATOMIC_BUILTINS
+ #   define USE_ATOMICS_BUILTINS
++#   if (__INTPTR_WIDTH__ == 32) && ( defined(__MIPSEL__) || defined(__powerpc__) )
++#   define NEED_ATOMICS_GENERIC64
++#   endif
+ #elif defined(SOLARIS2) && SOLARIS2 >= 10
+ #   define USE_ATOMICS_SOLARIS
+ #   define NEED_ATOMICS_GENERIC64
+--- apr.orig/atomic/unix/builtins64.c
 apr/atomic/unix/builtins64.c
+@@ -16,7 +16,7 @@
+ 
+ #include "apr_arch_atomic.h"
+ 
+-#ifdef USE_ATOMICS_BUILTINS
++#if defined(USE_ATOMICS_BUILTINS) && ! defined(NEED_ATOMICS_GENERIC64)
+ 
+ APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
+ {
+--- apr.orig/atomic/unix/builtins.c
 apr/atomic/unix/builtins.c
+@@ -20,7 +20,11 @@
+ 
+ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
+ {
++#if defined (NEED_ATOMICS_GENERIC64)
++return apr__atomic_generic64_init(p);
++#else
+ return APR_SUCCESS;
++#endif
+ }
+ 
+ APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff -Nru apr.old/apr-1.7.0/debian/symbols.common apr/apr-1.7.0/debian/symbols.common
--- apr.old/apr-1.7.0/debian/symbols.common	2020-08-30 21:07:02.0 +0200
+++ apr/apr-1.7.0/debian/symbols.common	2020-12-24 17:54:31.659743330 +0100
@@ -588,4 +588,4 @@
  apr_vformatter@Base 1.2.7
  apr_vsnprintf@Base 1.2.7
  apr_wait_for_io_or_timeout@Base 1.2.7
- (arch=mipsel powerpc)apr__atomic_generic64_init@Base 1.7.0-3~
+ (arch=mipsel m68k powerpc sh3 sh4)apr__atomic_generic64_init@Base 1.7.0-3~


Processed: Re: Bug#978018: libapr1: Please add 64-bit atomics workaround for m68k and sh4

2020-12-24 Thread Debian Bug Tracking System
Processing control commands:

> tags -1 +patch
Bug #978018 [src:apr] libapr1: Please add 64-bit atomics workaround for m68k 
and sh4
Added tag(s) patch.

-- 
978018: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=978018
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#978018: libapr1: Please add 64-bit atomics workaround for m68k and sh4

2020-12-24 Thread John Paul Adrian Glaubitz
Source: apr
Version: 1.7.0-4
Severity: normal
User: debian-...@lists.debian.org
Usertags: m68k
X-Debbugs-Cc: debian-...@lists.debian.org

Hello!

subversion currently FTBFS on m68k and sh4 because the configure process fails
to properly link against libserf [1]:

configure:5604: gcc -o conftest -g -O2 
-fdebug-prefix-map=/build/subversion-5EzMph/subversion-1.14.0=. 
-specs=/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat 
-Werror=format-security   -pthread -Wdate-time -D_FORTIFY_SOURCE=2   -DLINUX 
-D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -I/usr/include/apr-1.0   
-I/usr/include/apr-1.0 -I/usr/include -I/usr/include/serf-1 
-specs=/usr/share/dpkg/pie-link.specs -Wl,-z,relro -Wl,-z,nowconftest.c 
-lserf-1 -L/usr/lib/m68k-linux-gnu -laprutil-1 -L/usr/lib/m68k-linux-gnu 
-lapr-1 -lz  >&5
/usr/bin/ld: /usr/lib/m68k-linux-gnu/libapr-1.so: undefined reference to 
`__sync_fetch_and_sub_8'
/usr/bin/ld: /usr/lib/m68k-linux-gnu/libapr-1.so: undefined reference to 
`__sync_sub_and_fetch_8'
/usr/bin/ld: /usr/lib/m68k-linux-gnu/libapr-1.so: undefined reference to 
`__sync_fetch_and_add_8'
/usr/bin/ld: /usr/lib/m68k-linux-gnu/libapr-1.so: undefined reference to 
`__sync_lock_test_and_set_8'
/usr/bin/ld: /usr/lib/m68k-linux-gnu/libapr-1.so: undefined reference to 
`__sync_val_compare_and_swap_8'
collect2: error: ld returned 1 exit status

This should be fixable using the same approach as for 32-bit MIPS and PowerPC 
[2].

Could you therefore apply the fix for m68k and sh4 as well so that subversions 
builds on these targets?

Thanks,
Adrian

> [1] 
> https://buildd.debian.org/status/fetch.php?pkg=subversion=m68k=1.14.0-3=1608803200=0
> [2] 
> https://salsa.debian.org/apache-team/apr/-/commit/2df4f34a2fa3474806f89a15148afa7121c642bf

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913