During exit, libraries are unloaded and global destructors are run. If
we call dlclose(3) from inside the global destructors, we might be
telling libdl to unload a module it has already unloaded.
I cannot reproduce the issue on my Fedora 17 machine with glibc 2.15,
but it could be reliably be reproduced on an Ubuntu 11.10. The assertion
is identical to the one reported upstream at
http://sourceware.org/bugzilla/show_bug.cgi?id=11941 (see better
explanation at https://bugzilla.novell.com/show_bug.cgi?id=622977). I
cannot find any evidence in glibc's source code that the bug has been
fixed.
Change-Id: I97745f89e8c5481196e645dada8762d607a9fb2c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>