[uClibc] __cxa_atexit implementation
Stephen Warren
swarren at wwwdotorg.org
Mon Aug 15 04:33:56 UTC 2005
Stephen Warren wrote:
> When I dlopen/dlclose a .so with a global object with ctors/dtors and
> everything built with -fuse-cxa-atexit and the above hacked __cxa_atexit
> in the .so, however, I do see a segfault on dlclose. I have not yet
> tracked down if this is related. I'll debug this more...
Hmm. dlopen runs global ctors fine. dlclose doesn't run the dtors, no
doubt due to __cxa_finalize being missing. What's even worse is that
when the app quits, the .so's dtors are still in the list of dtors to
run, so __exit_handler attempts to run them, thus touching memory where
the now-unmapped .so file was.
I guess I need to implement __cxa_finalize too. Looking at glibc, I
think it's pretty easy to implement that function. It does require
re-working atexit() to call __cxa_atexit, so I guess it makes sense to
completely remove the config option I added in the previous patch. Also,
atexit now needs to reference __dso_handle, so I hope that's just a
matter of cut/paste the extern (and weak, if I recall) definition from
glibc...
--
Stephen Warren, Software Engineer, NVIDIA, Fort Collins, CO
swarren at wwwdotorg.org http://www.wwwdotorg.org/pgp.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20050814/e001b77c/attachment.pgp
More information about the uClibc
mailing list