This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] stdlib: Make atexit to not act as __cxa_atexit
- From: Florian Weimer <fweimer at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 02 Jul 2019 09:44:31 +0200
- Subject: Re: [RFC] stdlib: Make atexit to not act as __cxa_atexit
- References: <20190701205904.22287-1-adhemerval.zanella@linaro.org>
* Adhemerval Zanella:
> 3. exit is the only way where atexit handlers are actually called.
> Unloading a library through dlclose does not issue the atexit
> anymore (this is the main semantic change).
Sorry, I don't think this is the right direction. We got the current
atexit behavior from Solaris, and I think it is useful.
<https://docs.oracle.com/cd/E88353_01/html/E37843/atexit-3c.html>
I think the bug is that our implementation of that behavior interferes
with the execution order when there is no dlclose at all. There should
be a different way for fixing that.
Maybe we can turn __cxa_finalize into a NOP and have the dynamic loader
handle atexit handlers directly on dlclose (assuming that it's always
called before the other ELF destructors)?
Or otherwise use flags to mark things, but in such a way that the
handlers are processed in reverse atexit order, unless a dlclose
happens.
Thanks,
Florian