[PATCH] elf: Remove __glibc_likely from _dl_sort_maps
litenglong
litenglong@kylinos.cn
Fri Aug 14 02:32:16 GMT 2026
_dl_sort_maps is only called during shared object loading and
unloading, not on any hot path. The branch predictor hint has no
measurable benefit, and removing it simplifies the code and avoids
future maintenance when the default algorithm changes.
Suggested-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
---
elf/dl-sort-maps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elf/dl-sort-maps.c b/elf/dl-sort-maps.c
index 28ba850a6b..1469952b3a 100644
--- a/elf/dl-sort-maps.c
+++ b/elf/dl-sort-maps.c
@@ -303,7 +303,7 @@ _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))
+ if (GLRO(dl_dso_sort_algo) == dso_sort_algorithm_original)
_dl_sort_maps_original (maps, nmaps, force_first, for_fini);
else
_dl_sort_maps_dfs (maps, nmaps, force_first, for_fini);
--
2.25.1
More information about the Libc-alpha
mailing list