1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

Consolidate link map sorting

Combine the four places where link maps are sorted into a single function.
This also moves the logic to skip the first map (representing the main
binary) to the callers.
This commit is contained in:
Andreas Schwab
2017-11-07 15:24:19 +01:00
parent de61465c04
commit c2c299fd24
8 changed files with 153 additions and 215 deletions

View File

@@ -241,8 +241,10 @@ _dl_close_worker (struct link_map *map, bool force)
}
}
/* Sort the entries. */
_dl_sort_fini (maps, nloaded, used, nsid);
/* Sort the entries. We can skip looking for the binary itself which is
at the front of the search list for the main namespace. */
_dl_sort_maps (maps + (nsid == LM_ID_BASE), nloaded - (nsid == LM_ID_BASE),
used + (nsid == LM_ID_BASE), true);
/* Call all termination functions at once. */
#ifdef SHARED