https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71971
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |amonakov at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
The library is not unloaded on glibc due to STB_GNU_UNIQUE binding on get::i.
You can opt-out of creating symbols with that binding using -fno-gnu-unique.
But note there was never any guarantee that destructors would be invoked on
dlclose. On musl libc, dlclose is a no-op, and all unloading/destruction
happens on program exit (see the rationale here:
http://wiki.musl-libc.org/wiki/Functional_differences_from_glibc#Unloading_libraries
). For portable code, you cannot assume that dlclose causes immediate
unloading.