On Fri, 11 Jun 2021 22:38:09 -0400
George Koehler <kern...@gmail.com> wrote:

> On Fri, 11 Jun 2021 19:13:46 +0000
> Charlene Wendling <juliana...@posteo.jp> wrote:
> 
> > Hi,
> > 
> > As reported in the fediverse, sdl2 generates SIGILL on Mac G3s [0].
> > 
> > sdl2 is built with AltiVec support, runtime detection is present and
> > valid (see $WRKSRC/src/cpuinfo/SDL_cpuinfo.c), yet failing. So the
> > simple solution is to remove AltiVec from the build for now.
> > 
> > I've tested this on my PowerBook G4 against ffplay, mpv,
> > openttd and scummvm, without issues.
> > 
> > I've also tested successfully these ports on my Mac Mini G4, but
> > this time, using a kernel without the ALTIVEC option.
> > 
> > OK?
> 
> ok gkoehler@
> 
> SDL-1.x (devel/sdl) might need the same --enable-altivec=no fix, but
> I didn't try it.
> 
> SDL was using ${CC} -maltivec, so it's altivec blitter can use
> <altivec.h> operations.  The problem is that ${CC} -maltivec can also
> optimize any *.c code with altivec.  (graphics/ffmpeg had the same
> problem when we tried to enable altivec.)
> 
> Later, one might try to enable altivec again by moving the altivec
> blitter to a separate file, and compiling only that file with
> -maltivec (as xenocara/lib/pixman does now).
> 
> --George
> 
> > Charlène.
> > 
> > 
> > [0] https://empty.cafe/@will/106329827929064693

You were right, SDL 1.x is impacted as well. I've updated the diff
below to include SDL 1.x. It has been tested successfully against
frozen-bubble and tutris. xmoto fails with:

Program received signal SIGILL, Illegal instruction.
0x9830c5f0 in jsimd_idct_ifast_altivec ()
from /usr/local/lib/libjpeg.so.70.0

So i know what's up next, but given a lot of stuff depend on libjpeg, it
should be way longer, since i may need to rebuild almost all my
current packages ;)

Charlène.


Index: devel/sdl2/Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile
--- devel/sdl2/Makefile 23 Jan 2021 17:47:43 -0000      1.34
+++ devel/sdl2/Makefile 12 Jun 2021 12:01:33 -0000
@@ -5,7 +5,7 @@ COMMENT=        cross-platform multimedia libra
 V=             2.0.14
 DISTNAME=      SDL2-${V}
 PKGNAME=       sdl2-${V}
-REVISION=      1
+REVISION=      2
 CATEGORIES=    devel
 MASTER_SITES=  https://www.libsdl.org/release/
 
@@ -50,6 +50,13 @@ CONFIGURE_ENV+=      CPPFLAGS="-I${LOCALBASE}
 
 .if ${MACHINE_ARCH} == "hppa"
 CONFIGURE_ARGS+= --disable-atomic
+.endif
+
+# The assembly code contains AltiVec instructions, whose support is not
+# properly detected at runtime. Fix SIGILLs on macppc G3s, while keeping
+# it for powerpc64.
+.if ${MACHINE_ARCH} == "powerpc"
+CONFIGURE_ARGS+= --enable-altivec=no
 .endif
 
 # tests in test subdir, but interactive and not hooked up to build
Index: devel/sdl/Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl/Makefile,v
retrieving revision 1.105
diff -u -p -r1.105 Makefile
--- devel/sdl/Makefile  23 Jan 2021 17:52:00 -0000      1.105
+++ devel/sdl/Makefile  12 Jun 2021 12:01:33 -0000
@@ -5,7 +5,7 @@ COMMENT=        cross-platform multimedia libra
 VERSION=       1.2.15
 DISTNAME=      SDL-${VERSION}
 PKGNAME=       ${DISTNAME:L}
-REVISION=      11
+REVISION=      12
 CATEGORIES=    devel
 MAINTAINER=    Thomas Frohwein <t...@openbsd.org>
 MASTER_SITES=  ${HOMEPAGE}release/
@@ -64,6 +64,13 @@ WANTLIB+=    X11 Xau Xdmcp Xext Xrandr Xren
 .endif
 
 NO_TEST=       Yes
+
+# The assembly code contains AltiVec instructions, whose support is not
+# properly detected at runtime. Fix SIGILLs on macppc G3s, while keeping
+# it for powerpc64.
+.if ${MACHINE_ARCH} == "powerpc"
+CONFIGURE_ARGS+= --enable-altivec=no
+.endif
 
 pre-configure:
        @mkdir -p ${WRKSRC}/src/audio/sndio


Reply via email to