git: a8e4b7a7e4cd - main - graphics/libglvnd: fix build on powerpc64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 22 Feb 2022 08:41:38 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a8e4b7a7e4cdc67a920e8ce202aad724775af914

commit a8e4b7a7e4cdc67a920e8ce202aad724775af914
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-02-22 08:33:42 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-02-22 08:33:42 +0000

    graphics/libglvnd: fix build on powerpc64
    
    While the previous fix works on powerpc64le, it looks like on powerpc64
    clang is misoptimizing the code, needing -O0:
    cc -Isrc/util/libcJSON.a.p -Isrc/util -I../src/util -fvisibility=hidden -fno-color-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O3 -DUSE_PPC64_ASM -DENABLE_EGL_X11 -DHAVE_TYPEOF -DGLDISPATCH_USE_TLS -DUSE_DISPATCH_ASM -DUSE_ATTRIBUTE_CONSTRUCTOR -DHAVE_PTHREAD_RWLOCK -DHAVE_SYNC_INTRINSICS -DHAVE_MINCORE -DHAVE_RTLD_NOLOAD -DHAVE_DIRENT_DTYPE -DGLDISPATCH_ENABLE_PATCHING -DEGL_NO_X11 -O2 -pipe -no-integrated-as -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fPIC -MD -MQ src/util/libcJSON.a.p/cJSON.c.o -MF src/util/libcJSON.a.p/cJSON.c.o.d -o src/util/libcJSON.a.p/cJSON.c.o -c ../src/util/cJSON.c
    /tmp/cJSON-528d5f.s: Assembler messages:
    /tmp/cJSON-528d5f.s:327: Error: unrecognized opcode: `vxor'
    /tmp/cJSON-528d5f.s:337: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:339: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:340: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:1507: Error: unrecognized opcode: `vxor'
    /tmp/cJSON-528d5f.s:1515: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:1517: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:1519: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:1520: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:1937: Error: unrecognized opcode: `lvx'
    /tmp/cJSON-528d5f.s:1940: Error: unrecognized opcode: `lvx'
    /tmp/cJSON-528d5f.s:1942: Error: unrecognized opcode: `vspltb'
    /tmp/cJSON-528d5f.s:1948: Error: unrecognized opcode: `lvx'
    /tmp/cJSON-528d5f.s:1950: Error: unrecognized opcode: `lvx'
    /tmp/cJSON-528d5f.s:1951: Error: unrecognized opcode: `lvsl'
    /tmp/cJSON-528d5f.s:1952: Error: unrecognized opcode: `vperm'
    /tmp/cJSON-528d5f.s:1953: Error: unrecognized opcode: `vcmpequb'
    /tmp/cJSON-528d5f.s:1954: Error: unrecognized opcode: `vsel'
    /tmp/cJSON-528d5f.s:1955: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:2314: Error: unrecognized opcode: `vxor'
    /tmp/cJSON-528d5f.s:2321: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:2323: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:2325: Error: unrecognized opcode: `stvx'
    /tmp/cJSON-528d5f.s:2327: Error: unrecognized opcode: `stvx'
    cc: error: assembler command failed with exit code 1 (use -v to see invocation)
---
 graphics/libglvnd/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/graphics/libglvnd/Makefile b/graphics/libglvnd/Makefile
index f54418205347..5315970b50a8 100644
--- a/graphics/libglvnd/Makefile
+++ b/graphics/libglvnd/Makefile
@@ -27,9 +27,12 @@ X11_MESON_ENABLED=	x11 glx
 
 .include <bsd.port.options.mk>
 
-.if ${ARCH:Mpowerpc64*}
+.if ${ARCH} == powerpc64le
 BUILD_DEPENDS=	as:devel/binutils
 CFLAGS+=	-no-integrated-as
+.elif ${ARCH} == powerpc64
+BUILD_DEPENDS=	as:devel/binutils
+CFLAGS+=	-no-integrated-as -O0
 .endif
 
 # Lots of software expects gl.pc even when it can build with EGL only