diff --git a/srcpkgs/libglvnd/patches/musl-noasm-use-o0.patch b/srcpkgs/libglvnd/patches/musl-noasm-use-o0.patch new file mode 100644 index 00000000000..0ecf492e1c5 --- /dev/null +++ b/srcpkgs/libglvnd/patches/musl-noasm-use-o0.patch @@ -0,0 +1,52 @@ +From d82adbb78a246d68d67a951cdfc81b757fac2453 Mon Sep 17 00:00:00 2001 +From: Daniel Kolesa +Date: Mon, 10 May 2021 23:02:21 +0200 +Subject: [PATCH] lower optimization for dispatch code when using C + tsb + +there appears to be some bug in the code which causes crashes +with threaded opengl setups; this manifests at least on ppc64(le) +with musl (where one must set `-Dtls=enabled`). I haven't been +able to track it down yet, but this workaround at least makes it +stop happening. +--- + src/GLdispatch/vnd-glapi/meson.build | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git src/GLdispatch/vnd-glapi/meson.build src/GLdispatch/vnd-glapi/meson.build +index 615cdff..94310b3 100644 +--- src/GLdispatch/vnd-glapi/meson.build ++++ src/GLdispatch/vnd-glapi/meson.build +@@ -35,8 +35,12 @@ else + endif + + _entry_files = [] ++_extra_cflags = [] + if gl_dispatch_type == 'pure_c' + _entry_files += 'entry_pure_c.c' ++ if not have_tls ++ _extra_cflags += '-O0' ++ endif + else + _entry_files += 'entry_common.c' + if gl_dispatch_type != 'armv7_tsd' +@@ -73,7 +77,7 @@ libglapi = static_library( + glapi_mapi_tmp_h, + _entry_files, + ], +- c_args : ['-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path())], ++ c_args : ['-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path())] + _extra_cflags, + include_directories : inc_include, + dependencies : idep_utils_misc, + gnu_symbol_visibility : 'hidden', +@@ -89,7 +93,7 @@ foreach g : ['gl', 'opengl', 'glesv1', 'glesv2'] + c_args : [ + '-DSTATIC_DISPATCH_ONLY', + '-DMAPI_ABI_HEADER="@0@"'.format(header.full_path()), +- ], ++ ] + _extra_cflags, + include_directories : [inc_include, inc_util], + gnu_symbol_visibility : 'hidden', + ) +-- +2.31.1 + diff --git a/srcpkgs/libglvnd/template b/srcpkgs/libglvnd/template index 77b80b0abcf..3d974e70b9a 100644 --- a/srcpkgs/libglvnd/template +++ b/srcpkgs/libglvnd/template @@ -1,7 +1,7 @@ # Template file for 'libglvnd' pkgname=libglvnd version=1.3.2 -revision=1 +revision=2 wrksrc="libglvnd-v${version}" build_style=meson hostmakedepends="pkg-config" @@ -21,7 +21,10 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then configure_args="-Dtls=disabled" fi +# ppc64_tsd (used when ppc64_tls is not available) +# is broken with threads, so disable it on musl case "$XBPS_TARGET_MACHINE" in + ppc*-musl) configure_args+=" -Dasm=disabled";; ppc64*) ;; arm*|mips*|ppc*) configure_args+=" -Dasm=disabled";; esac