pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

MesaLib: do the atexit dance in more places



Module Name:	pkgsrc-wip
Committed By:	Tobias Nygren <tnn%NetBSD.org@localhost>
Pushed By:	tnn
Date:		Tue Jul 20 14:48:13 2021 +0200
Changeset:	e0a490a2831e8ce08bfd638a28b5b8ca3dee7c40

Modified Files:
	MesaLib/distinfo
Added Files:
	MesaLib/patches/patch-src_drm-shim_drm__shim.c
	MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c
	MesaLib/patches/patch-src_mesa_main_context.c
	MesaLib/patches/patch-src_mesa_main_formats.c
	MesaLib/patches/patch-src_util_u__process.c

Log Message:
MesaLib: do the atexit dance in more places

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e0a490a2831e8ce08bfd638a28b5b8ca3dee7c40

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 MesaLib/distinfo                                   |  5 ++++
 MesaLib/patches/patch-src_drm-shim_drm__shim.c     | 28 ++++++++++++++++++
 .../patch-src_gallium_frontends_osmesa_osmesa.c    | 29 ++++++++++++++++++
 MesaLib/patches/patch-src_mesa_main_context.c      | 28 ++++++++++++++++++
 MesaLib/patches/patch-src_mesa_main_formats.c      | 28 ++++++++++++++++++
 MesaLib/patches/patch-src_util_u__process.c        | 34 ++++++++++++++++++++++
 6 files changed, 152 insertions(+)

diffs:
diff --git a/MesaLib/distinfo b/MesaLib/distinfo
index 9a534b6d0a..5122c88beb 100644
--- a/MesaLib/distinfo
+++ b/MesaLib/distinfo
@@ -6,6 +6,7 @@ SHA512 (mesa-21.1.5.tar.xz) = d9e0e1b6a1d717febee2aa67b06620c9a21e061ea7e594be5b
 Size (mesa-21.1.5.tar.xz) = 15286704 bytes
 SHA1 (patch-include_c11_threads__posix.h) = e1dca04b5c514d20123ef99338c6dabedbc14c5f
 SHA1 (patch-src_compiler_builtin__type__macros.h) = e4868011711fb89a293580a12eb603b8e7162336
+SHA1 (patch-src_drm-shim_drm__shim.c) = 6884d31dc3e9d47aac1785589ab289a601e64545
 SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = 9230fbae2c04246ebca8437ecad694bbae857fbe
 SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = ccf7c3ba7bdac39f9924102868f30afd7f4f05a2
 SHA1 (patch-src_egl_main_eglglobals.c) = 0d52014f52e62fc5fa6650336ddb0011ecf331e6
@@ -18,6 +19,7 @@ SHA1 (patch-src_gallium_drivers_nouveau_nv50_nv84__video.c) = 1b4239fe053523835e
 SHA1 (patch-src_gallium_drivers_vc4_vc4__bufmgr.c) = 1d591d346486fdf58893f69ab92a272e6a31a987
 SHA1 (patch-src_gallium_frontends_clover_llvm_invocation.cpp) = c59ab60843717369be20a83f658960e91ce68bf4
 SHA1 (patch-src_gallium_frontends_clover_util_range.hpp) = c1bd73721482642e62378c70cbe245c304c36d4f
+SHA1 (patch-src_gallium_frontends_osmesa_osmesa.c) = 36631301b02cf89f152925b62f538a3c0b6ab601
 SHA1 (patch-src_glx_dri__common.c) = 7fa80f8da89ba90649db170e45c8e842cf69c1eb
 SHA1 (patch-src_glx_dri__common.h) = 0274877f8c65a4bb729536a897df4704897a4c6e
 SHA1 (patch-src_glx_glxclient.h) = f0358179ae397bc8677597b0ccb9a471f40f15de
@@ -28,11 +30,14 @@ SHA1 (patch-src_intel_tools_aubinator__error__decode.c) = d8f636e3c3e76763a505a1
 SHA1 (patch-src_mapi_entry__x86-64__tls.h) = f3e93565a2247b47495489f2dbecdc354d4a21a0
 SHA1 (patch-src_mapi_entry__x86__tls.h) = 1ca12843b7214831c25c5cdd7860dad94312c118
 SHA1 (patch-src_mapi_u__current.c) = 996a1839a8dcf60468a84302750befa18e166f44
+SHA1 (patch-src_mesa_main_context.c) = ae26f984b30369554a0e24d03006533c75e56a9b
 SHA1 (patch-src_mesa_main_extensions.c) = 8a6094690864289393315bd0ccc4ebd1e0c59ca5
+SHA1 (patch-src_mesa_main_formats.c) = b0c31116767422efe732bc77136b03b2fddfba31
 SHA1 (patch-src_mesa_main_shader__query.cpp) = 3f9c31645d87855759def11344dee16af23c7be3
 SHA1 (patch-src_mesa_x86_common__x86.c) = f8c4b93443ef66d017f6aa114b877565b30f2598
 SHA1 (patch-src_util_build__id.c) = 7a9547bbda9d2fb9f0018ccf27b70b59e497aa2c
 SHA1 (patch-src_util_strndup.h) = 73f49694ca48ad6b9a9d8346c5b84fddec2463bd
 SHA1 (patch-src_util_u__atomic.h) = 31d4514538ef5ee53012695eb5c66134aaec981e
+SHA1 (patch-src_util_u__process.c) = 9b785d660f3d55803315598a66370139fcd9168f
 SHA1 (patch-src_util_u__queue.c) = e8d6b00473a16b6a32dcacd5ae092326fb2adb84
 SHA1 (patch-src_util_u__thread.h) = b273472a779edcc44c34174b96a43469c366e702
diff --git a/MesaLib/patches/patch-src_drm-shim_drm__shim.c b/MesaLib/patches/patch-src_drm-shim_drm__shim.c
new file mode 100644
index 0000000000..21508dd56d
--- /dev/null
+++ b/MesaLib/patches/patch-src_drm-shim_drm__shim.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+atexit() is not a good idea in shared libraries.
+
+--- src/drm-shim/drm_shim.c.orig	2021-07-14 20:04:46.724922400 +0000
++++ src/drm-shim/drm_shim.c
+@@ -162,7 +162,11 @@ drm_shim_override_file(const char *conte
+    override->contents = strdup(contents);
+ }
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ destroy_shim(void)
+ {
+    _mesa_set_destroy(opendir_set, NULL);
+@@ -227,7 +231,9 @@ init_shim(void)
+ 
+    drm_shim_device_init();
+ 
++#if !defined(HAVE_NOATEXIT)
+    atexit(destroy_shim);
++#endif
+ }
+ 
+ /* Override libdrm's reading of various sysfs files for device enumeration. */
diff --git a/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c b/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c
new file mode 100644
index 0000000000..b050cad3c7
--- /dev/null
+++ b/MesaLib/patches/patch-src_gallium_frontends_osmesa_osmesa.c
@@ -0,0 +1,29 @@
+$NetBSD$
+
+atexit() is not a good idea in shared libraries.
+
+--- src/gallium/frontends/osmesa/osmesa.c.orig	2021-07-14 20:04:55.420007000 +0000
++++ src/gallium/frontends/osmesa/osmesa.c
+@@ -134,7 +134,11 @@ osmesa_st_get_param(struct st_manager *s
+ static struct st_manager *stmgr = NULL;
+ static struct st_api *stapi = NULL;
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ destroy_st_manager(void)
+ {
+    if (stmgr) {
+@@ -151,8 +155,10 @@ destroy_st_manager(void)
+ static void
+ create_st_manager(void)
+ {
++#if !defined(HAVE_NOATEXIT)
+    if (atexit(destroy_st_manager) != 0)
+       return;
++#endif
+ 
+    stmgr = CALLOC_STRUCT(st_manager);
+    if (stmgr) {
diff --git a/MesaLib/patches/patch-src_mesa_main_context.c b/MesaLib/patches/patch-src_mesa_main_context.c
new file mode 100644
index 0000000000..c2725e8007
--- /dev/null
+++ b/MesaLib/patches/patch-src_mesa_main_context.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+atexit() is not a good idea in shared libraries.
+
+--- src/mesa/main/context.c.orig	2021-07-14 20:04:58.296035000 +0000
++++ src/mesa/main/context.c
+@@ -324,7 +324,11 @@ _mesa_destroy_visual( struct gl_config *
+  * Calls all the various one-time-fini functions in Mesa
+  */
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ one_time_fini(void)
+ {
+    glsl_type_singleton_decref();
+@@ -357,7 +361,9 @@ one_time_init(void)
+       _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+    }
+ 
++#if !defined(HAVE_NOATEXIT)
+    atexit(one_time_fini);
++#endif
+ 
+ #if defined(DEBUG)
+    if (MESA_VERBOSE != 0) {
diff --git a/MesaLib/patches/patch-src_mesa_main_formats.c b/MesaLib/patches/patch-src_mesa_main_formats.c
new file mode 100644
index 0000000000..0cd18ebae5
--- /dev/null
+++ b/MesaLib/patches/patch-src_mesa_main_formats.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+atexit() is not a good idea in shared libraries.
+
+--- src/mesa/main/formats.c.orig	2021-07-14 20:04:58.323035200 +0000
++++ src/mesa/main/formats.c
+@@ -451,7 +451,11 @@ _mesa_format_to_array_format(mesa_format
+ static struct hash_table *format_array_format_table;
+ static once_flag format_array_format_table_exists = ONCE_FLAG_INIT;
+ 
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
+ static void
++#endif
+ format_array_format_table_destroy(void)
+ {
+    _mesa_hash_table_destroy(format_array_format_table, NULL);
+@@ -496,7 +500,9 @@ format_array_format_table_init(void)
+                                          (void *)(intptr_t)f);
+    }
+ 
++#if !defined(HAVE_NOATEXIT)
+    atexit(format_array_format_table_destroy);
++#endif
+ }
+ 
+ mesa_format
diff --git a/MesaLib/patches/patch-src_util_u__process.c b/MesaLib/patches/patch-src_util_u__process.c
new file mode 100644
index 0000000000..a87243d1ef
--- /dev/null
+++ b/MesaLib/patches/patch-src_util_u__process.c
@@ -0,0 +1,34 @@
+$NetBSD$
+
+atexit() is not a good idea in shared libraries.
+
+--- src/util/u_process.c.orig	2021-07-14 20:04:59.260044300 +0000
++++ src/util/u_process.c
+@@ -48,9 +48,15 @@
+ 
+ static char *path = NULL;
+ 
+-static void __freeProgramPath()
++#if defined(HAVE_NOATEXIT)
++static void __attribute__((__destructor__))
++#else
++static void
++#endif
++__freeProgramPath()
+ {
+-   free(path);
++   if (path)
++     free(path);
+    path = NULL;
+ }
+ 
+@@ -68,7 +74,9 @@ __getProgramName()
+        */
+       if (!path) {
+          path = realpath("/proc/self/exe", NULL);
++#if !defined(HAVE_NOATEXIT)
+          atexit(__freeProgramPath);
++#endif
+       }
+ 
+       if (path && strncmp(path, program_invocation_name, strlen(path)) == 0) {


Home | Main Index | Thread Index | Old Index