Hi Jakub,

    I did tried to use the glibc qsort. I compared the source of the
two versions.
    I found that the BSD one is more self-contained and easy for
integration with libiberty.
    That's why the BSD one is preferred.
    And we already have several BSD functions there in libiberty
(libiberty/random.c, an example).
Cheers,
Felix


On Wed, Aug 13, 2014 at 8:16 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Wed, Aug 13, 2014 at 08:12:03PM +0800, Felix Yang wrote:
>>     The qsort library function may have different behavior on
>> different hosts (say Linux vs MinGW).
>>     We may have different sorting results with qsort when there are
>> elements with the same key value.
>>     GCC uses qsort a lot. And the output of certain optimizations,
>> such as IRA, relies on the sorting result of this library function.
>>     The problem is that we may have different assembly code of GCC on
>> different hosts even with the same source file.
>>     Normally this is not what a GCC user expect to see.
>>     In order to fix this issue, I am adding Berkeley qsort to
>> libiberty in order to override the one from the library.
>
> Why have you picked a BSD one rather than the GNU one?
> glibc qsort is highly optimized and has some other nice properties qsort
> from many other sources does not have.
>
>         Jakub

Reply via email to