Created attachment 118072 [details] Patch to use __attribute__((destructor)) in ralloc.c Hi! On Linux, atexit(3) handlers are called when the program exits but also when a library is unloaded. The latter behavior is a Glibc extension. On systems where this extension is not supported, this causes an application to crash when, for instance, a library using ralloc is dlclosed: at program exit, the registered function is no longer in memory. For example, this happens with OpenCL applications using an ICD loader on FreeBSD. __attribute__((destructor)) fixes the problem because such handlers are called when a library is unloaded and when the program exits.
Created attachment 118120 [details] [review] Patch to use __attribute__((destructor)) in ralloc.c This new patch adds a test for __attribute__((destructor)) in the configure script and hides this attribute behind a "DESTRUCTOR" macro in src/util/macros.h. This is requested by Matt Turner on the mesa-dev@ mailing-list.
atexit() no longer exists in src/util/ralloc.{c,h}
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.