bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dlltool 2.11: assignment of ordinals depends on the platform


From: Eberhard Mattes
Subject: dlltool 2.11: assignment of ordinals depends on the platform
Date: Tue, 26 Jun 2001 01:18:48 +0200 (MET DST)

Before assigning ordinals, dlltool uses qsort() with pfunc() to sort
by ordinal.  Exports which have not yet been assigned an ordinal all
compare equal.  In consequence, the order of those exports depends on
the implementation of qsort() as qsort() is not required to be stable.

Here's a patch which makes the sort stable, resulting in identical
results on different platforms, independent of the implementation of
qsort():

*** dlltool.c.orig      Tue Dec 19 23:22:02 2000
--- dlltool.c   Tue Jun 26 00:59:16 2001
***************
*** 2831,2837 ****
    export_type *ap = *(export_type **) a;
    export_type *bp = *(export_type **) b;
    if (ap->ordinal == bp->ordinal)
!     return 0;
  
    /* unset ordinals go to the bottom */
    if (ap->ordinal == -1)
--- 2831,2837 ----
    export_type *ap = *(export_type **) a;
    export_type *bp = *(export_type **) b;
    if (ap->ordinal == bp->ordinal)
!     return strcmp (ap->name, bp->name);       /* Make the sort stable */
  
    /* unset ordinals go to the bottom */
    if (ap->ordinal == -1)

-- 
  Eberhard Mattes <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]