[BZ #821]
* elf/dl-fini.c (_dl_fini): Split sorting of the maps in separate
function _dl_sort_fini.
(_dl_sort_fini): New function.
* sysdeps/generic/ldsodefs.h: Declare _dl_sort_fini.
* elf/dl-close.c (_dl_close): Call _dl_sort_fini before running
destructors to call them in the right order.
initializer functions have completed. */
extern void _dl_fini (void) internal_function;
+/* Sort array MAPS according to dependencies of the contained objects. */
+extern void _dl_sort_fini (struct link_map *l, struct link_map **maps,
+ size_t nmaps, char *used, Lmid_t ns)
+ internal_function;
+
/* The dynamic linker calls this function before and having changing
any shared object mappings. The `r_state' member of `struct r_debug'
says what change is taking place. This function's address is