void-packages/srcpkgs/libglvnd/patches/musl-noasm-use-o0.patch
q66 3387aeb4d6 libglvnd: work around crashing on musl systems and multithreaded gl
firstly, disable ppc64 tsb assembly since it appears to be broken
in multithread contexts; secondly, when not using asm, compile the
dispatch code with low optimization level as doing otherwise seems
to result in crashes in multithreaded contexts

we'll need to fix this properly at some point, for now do this

the assembly code is seemingly buggy and causes strange crashes
when used with threaded code, so fall back to pure C paths
2021-05-10 23:12:05 +02:00

52 lines
1.7 KiB
Diff

From d82adbb78a246d68d67a951cdfc81b757fac2453 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
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