libdl: fix dlclose handling of symbol scope
libdl: fix dlclose handling of symbol scope

Defer removal of the local scope of a dl-opened library after
all the destructors (of itself and related dependencies) are actually
get unloaded, otherwise any function registered via atexit()
won't be resolved.

Signed-off-by: Carmelo Amoroso <532378793705a04edd56deb76ad8c0442834d55d@st.com>
Signed-off-by: Khem Raj <729d64b6f67515e258459a5f6d20ec88b2caf8df@gmail.com>
Signed-off-by: Filippo Arcidiacono <26825f07340f791bc0d38da89fcffcd93550a83c@st.com>

joel-porquet/tsar-uclibc,joel-porquet/tsar-uclibc,joel-porquet/tsar-uclibc,joel-porquet/tsar-uclibc