__cxa_atexit and __cxa_finalize implementation

Stephen Warren swarren at wwwdotorg.org
Tue Sep 13 16:46:53 UTC 2005


Joakim Tjernlund wrote:
>Stephen Warren wrote:
>>Did anyone have any feedback on this? Is it likely to get merged, or are
>>there problems with it?
> 
> 
> +/* Hide the symbol so that no definition but the one locally in the
> +   executable or DSO is used.  */
> +#ifdef HAVE_DOT_HIDDEN
> +asm (".hidden\tatexit");
>  #endif
> 
> Just had a quick look as I don't have much time ATM, but here goes:
>  Why do you hide atexit?
>  If you must hide it, use attribute_hidden instead.

Because glibc does it, of course:-)

But I think the reasoning is this:

Every app/DSO gets its own __dso_handle. This identifies which atexit
routines are tied to each DSO, so when a DSO unloads, only the atexit
routines registered by that DSO are run - the others are left around.

atexit() references __dso_handle. If code in a DSO calls atexit(), the
definition of __dso_handle for that DSO must be used (since __dso_handle
is also hidden). To achieve this, we make atexit() hidden, so each
app/DSO gets its own copy, that references the correct app/DSO-specific
version of __dso_handle.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20050913/7e2f92e3/attachment.pgp 


More information about the uClibc mailing list