Hi ports --

zzuf is one of those ports that uses the __sync functions, meaning that hppa can't build it.
This diff does the follow:
* Convert __sync to __atomic
* Set COMPILER=base-clang ports-gcc

As I understand it, all archs with gcc-4.2.1 as its base compiler has access to ports-gcc too. m88k can't build this anyway as gcc-3 doesn't have the __sync functions either.

Test output is exactly the same on amd64 with the __sync to __atomic conversion.

hppa is happy with this.

OK?

~Brian

Index: Makefile
===================================================================
RCS file: /cvs/ports/misc/zzuf/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- Makefile	3 May 2018 11:02:57 -0000	1.19
+++ Makefile	15 Apr 2019 21:34:50 -0000
@@ -1,11 +1,10 @@
 # $OpenBSD: Makefile,v 1.19 2018/05/03 11:02:57 solene Exp $
 
-BROKEN-hppa=		__sync_lock_test_and_set_4 in zzuf_mutex_lock
-
 COMMENT=		transparent application input fuzzer
 
 VERSION=		0.15
 DISTNAME=		zzuf-${VERSION}
+REVISION=		0
 
 CATEGORIES=		misc security
 
@@ -15,6 +14,8 @@ MASTER_SITES=		https://github.com/samhoc
 PERMIT_PACKAGE_CDROM=	Yes
 
 WANTLIB=		c m
+
+COMPILER=		base-clang ports-gcc
 
 CONFIGURE_STYLE=	gnu
 # Necessary?
Index: patches/patch-src_util_mutex_h
===================================================================
RCS file: patches/patch-src_util_mutex_h
diff -N patches/patch-src_util_mutex_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_util_mutex_h	15 Apr 2019 21:34:50 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Replace nonstandard __sync_* with standard __atomic_* for hppa.
+
+Index: src/util/mutex.h
+--- src/util/mutex.h.orig
++++ src/util/mutex.h
+@@ -35,7 +35,7 @@ static inline void zzuf_mutex_lock(zzuf_mutex_t *l)
+     while (InterlockedExchange(l, 1));
+ #elif __GNUC__ || __clang__
+     do {}
+-    while (__sync_lock_test_and_set(l, 1));
++    while (__atomic_test_and_set(l, __ATOMIC_SEQ_CST));
+ #endif
+ }
+ 
+@@ -44,8 +44,7 @@ static inline void zzuf_mutex_unlock(zzuf_mutex_t *l)
+ #if _WIN32
+     InterlockedExchange(l, 0);
+ #elif __GNUC__ || __clang__
+-    *l = 0;
+-    __sync_synchronize();
++    __atomic_clear(l, __ATOMIC_SEQ_CST);
+ #endif
+ }
+ 

Reply via email to