Problem with atexit and _dl_fini

Nat! nat@mulle-kybernetik.com
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 
http://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic.html#BASELIB---CXA-FINALIZE

```
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.

Ciao
    Nat!



More information about the Libc-help mailing list