http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27692
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-11 13:08:19 UTC --- Namespace-scope objects aren't the problem; we've always handled them fine. The problem is with function-local statics, which aren't constructed until the function is called, so we can't determine the order of construction at compile time. We need to use atexit for them, and so for proper interleaving of destructors we need to use atexit for namespace-scope objects as well, but that can cause trouble with dlclose, which is why we created __cxa_atexit.