[PATCH] elf: Make _dl_sort_maps prefer default DFS algorithm
litenglong
litenglong@kylinos.cn
Thu Aug 13 12:16:38 GMT 2026
The default dynamic_sort tunable is 2, which maps to
dso_sort_algorithm_dfs. Update the likely branch to match the
default, without changing behavior for valid tunable values.
Reviewed-by: gaoxiang<gaoxiang@kylinos.cn>
---
elf/dl-sort-maps.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/elf/dl-sort-maps.c b/elf/dl-sort-maps.c
index 28ba850a6b..75e6fc1015 100644
--- a/elf/dl-sort-maps.c
+++ b/elf/dl-sort-maps.c
@@ -303,8 +303,8 @@ _dl_sort_maps (struct link_map **maps, unsigned int nmaps,
PTR_MANGLE/DEMANGLE, further impairing performance of small, common
input cases. A simple if-case with direct function calls appears to
be the fastest. */
- if (__glibc_likely (GLRO(dl_dso_sort_algo) == dso_sort_algorithm_original))
- _dl_sort_maps_original (maps, nmaps, force_first, for_fini);
- else
+ if (__glibc_likely (GLRO(dl_dso_sort_algo) == dso_sort_algorithm_dfs))
_dl_sort_maps_dfs (maps, nmaps, force_first, for_fini);
+ else
+ _dl_sort_maps_original (maps, nmaps, force_first, for_fini);
}
--
2.25.1
More information about the Libc-alpha
mailing list