Problem with atexit and _dl_fini

Carlos O'Donell carlos@redhat.com
Wed Jun 12 03:41:00 GMT 2019


On 6/11/19 6:40 PM, Nat! wrote:
> 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.

I disagree.

It would block existing plugin mechanisms from being able to reload their objects until they switched to some other mechanism like destructors.

It is a change which is not conservative and doesn't solve any real problems except an educational issue.

-- 
Cheers,
Carlos.



More information about the Libc-help mailing list