Hi Carlos, the sorting algorithm code portions of the patch has not been updated a lot for this v4 version, mainly a rebase of v3 to current master. Here was the v3 version for reference (responded to some v2 issues there). Unfortunately this one never seemed to got a review, though it seems the main issues were in the testing infrastructure patch. https://sourceware.org/pipermail/libc-alpha/2020-July/116546.html Note that in the attached patch, I still have the old sorting algorithm set as default, the more "conservative" setting. This can be adjusted if deemed appropriate when patch is approved. Tested current master on x86_64-linux with no regressions, seeking approval for getting this into 2.33. Thanks, Chung-Lin 2021-01-03 Chung-Lin Tang [BZ #17645] [BZ #15311] [BZ #15310] * elf/dl-close.c (_dl_close_worker): Remove used[], done[] char arrays, use l_map_used/l_map_done bitfields instead. Adjust call to _dl_sort_maps. * elf/dl-deps.c (_dl_map_object_deps): Adjust call to _dl_sort_maps. * elf/dl-fini.c (_dl_fini): Likewise. * elf/dl-sort_maps.c (_dl_sort_maps_original): Adapted from original _dl_sort_maps. (dfs_traversal): New static function. (_dl_sort_maps_dfs): New Reverse-Postorder (RPO) based implementation. (_dl_sort_maps): Select and call either _dl_sort_maps_original or _dl_sort_maps_dfs based on glibc.rtld.dynamic_sort. * elf/dl-tunables.list (rtld): New namespace with tunable 'dynamic_sort'. * include/link.h (struct link_map): Add l_visited:1, l_map_used:1, and l_map_done:1 bitfields. * sysdeps/generic/ldsodefs.h (_dl_sort_maps): Adjust declaration.