Problem with atexit and _dl_fini

Tue Jun 11 22:40:00 GMT 2019

Sorry for the spam, but I just thought of an easy fix for the situation, 
with this rewording of

The implementation shall arrange for__cxa_finalize() to be called during 
early shared library unload (e.g. dlclose()) with a handle to the shared 
library. The unload should fail, if the termination function list 
contains any __cxa_atexit-registered functions.
When the main program calls exit, the implementation shall cause any 
remaining __cxa_atexit-registered functions to be called, either by 
calling __cxa_finalize(NULL), or by walking the registration list itself.

The effect is, that atexit "poisoned" shared objects stay until 
termination, all others get unloaded as they are now, which would be IMO 
perfect and expected. As a positive side effect it seems like minimal 
code change.


More information about the Libc-help mailing list