[PATCH v2 2/2] src/readelf: use qsort instead of qsort_r.
Mark Wielaard
mark@klomp.org
Sun Jan 10 15:37:50 GMT 2021
Hi Érico,
Sorry for the late review.
On Wed, 2020-12-16 at 19:30 -0300, Érico Nogueira via Elfutils-devel wrote:
> From: Érico Rolim <erico.erc@gmail.com>
>
> This program is single threaded, so using qsort with a global variable
> isn't a danger. The interface for qsort_r isn't standardized (and
> diverges between glibc and FreeBSD, for example), which makes usage of
> qsort, where possible, preferrable.
I don't really like this one. Currently readelf isn't multi-threaded,
but precisely this, processing of different section data, could in
theory be done in parallel. But it isn't, so for now assuming single-
threadedness is OK. If we make this really parallel, and don't revert
back to using qsort_r, a better solution would be to have (6!)
different sort_listptr compar callback variants.
That said, applied since it does look OK for now.
Cheers,
Mark
More information about the Elfutils-devel
mailing list