Hi,

I've proposed a fix for x11/gnome/gnome-builder for ld.bfd archs and
possibly i386 (offlist), but on macppc it still failed due to undefined
references to 64-bit __sync_* primitives. 

libdazzle uses 64-bit __sync_* primitives that are not supported on
macppc. There is no __atomic_* fallback, but there is a non-atomic
one, that was unused. I've proposed to upstream to use it on
!linux ppc32 generally [0], and it has been merged.

With that, gnome-builder will build and run fine on macppc.

Comments/feedback are welcome,

Charlène.


[0] https://gitlab.gnome.org/GNOME/libdazzle/-/merge_requests/44


Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/gnome/libdazzle/Makefile,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 Makefile
--- Makefile    14 May 2020 14:59:03 -0000      1.17
+++ Makefile    12 Jun 2020 16:39:14 -0000
@@ -4,6 +4,7 @@ COMMENT=                companion library to GObject a
 
 GNOME_PROJECT=         libdazzle
 GNOME_VERSION=         3.36.0
+REVISION=              0
 
 SHARED_LIBS +=  dazzle-1.0                1.2 # 0
 
Index: patches/patch-src_util_dzl-counter_c
===================================================================
RCS file: patches/patch-src_util_dzl-counter_c
diff -N patches/patch-src_util_dzl-counter_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_util_dzl-counter_c        12 Jun 2020 16:39:14 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+Don't use unsupported 64-bit __sync primitives on powerpc, from:
+https://gitlab.gnome.org/GNOME/libdazzle/-/merge_requests/44
+
+Index: src/util/dzl-counter.c
+--- src/util/dzl-counter.c.orig
++++ src/util/dzl-counter.c
+@@ -52,7 +52,11 @@ G_DEFINE_BOXED_TYPE (DzlCounterArena, dzl_counter_aren
+ #define CELLS_PER_GROUP(ncpu)                             \
+   (((sizeof (CounterInfo) * COUNTERS_PER_GROUP) +         \
+     (sizeof(DzlCounterValue) * (ncpu))) / DATA_CELL_SIZE)
++#ifdef DZL_COUNTER_REQUIRES_ATOMIC
+ #define DZL_MEMORY_BARRIER __sync_synchronize()
++#else
++#define DZL_MEMORY_BARRIER 0
++#endif
+ 
+ typedef struct
+ {
Index: patches/patch-src_util_dzl-counter_h
===================================================================
RCS file: patches/patch-src_util_dzl-counter_h
diff -N patches/patch-src_util_dzl-counter_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_util_dzl-counter_h        12 Jun 2020 16:39:14 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Don't use unsupported 64-bit __sync primitives on powerpc, from:
+https://gitlab.gnome.org/GNOME/libdazzle/-/merge_requests/44
+
+Index: src/util/dzl-counter.h
+--- src/util/dzl-counter.h.orig
++++ src/util/dzl-counter.h
+@@ -163,6 +163,9 @@ G_BEGIN_DECLS
+ # define dzl_get_current_cpu() dzl_get_current_cpu_rdtscp()
+ #elif defined(__linux__)
+ # define dzl_get_current_cpu() dzl_get_current_cpu_call()
++#elif defined(__powerpc__) && !defined(__powerpc64__)
++# define dzl_get_current_cpu() 0
++# undef DZL_COUNTER_REQUIRES_ATOMIC
+ #else
+ # define dzl_get_current_cpu() 0
+ # define DZL_COUNTER_REQUIRES_ATOMIC 1

Reply via email to