[PATCH] elf: Make _dl_sort_maps prefer default DFS algorithm
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Thu Aug 13 12:31:45 GMT 2026
On 13/08/26 09:16, litenglong wrote:
> 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.
What does this change really gain here? I am inclined to avoid this kind of
code churn.
>
> 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);
> }
More information about the Libc-alpha
mailing list