From: nickc Date: Tue, 13 Jul 2004 12:55:40 +0000 (+0000) Subject: (elf_sort_symbol): Restructure code to avoid bug in Solairs hosted versions of X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=03a7401e7b95332fb572b4b025c74c2d94f1c622;p=pf3gnuchains%2Fsourceware.git (elf_sort_symbol): Restructure code to avoid bug in Solairs hosted versions of gcc. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8055cb199c..2aca71ac58 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-07-13 Kelvin Lee + + * elflink.c (elf_sort_symbol): Restructure code to avoid bug in + Solairs hosted versions of gcc. + 2004-07-10 James E Wilson * elfxx-ia64.c (elfNN_ia64_relax_ldxmov): Remove abfd parameter. diff --git a/bfd/elflink.c b/bfd/elflink.c index 1c1de27fc8..cf7d14ea36 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2733,24 +2733,26 @@ elf_add_dt_needed_tag (struct bfd_link_info *info, } /* Sort symbol by value and section. */ + static int elf_sort_symbol (const void *arg1, const void *arg2) { const struct elf_link_hash_entry *h1; const struct elf_link_hash_entry *h2; - bfd_signed_vma vdiff; h1 = *(const struct elf_link_hash_entry **) arg1; h2 = *(const struct elf_link_hash_entry **) arg2; - vdiff = h1->root.u.def.value - h2->root.u.def.value; - if (vdiff != 0) - return vdiff > 0 ? 1 : -1; - else - { - long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id; - if (sdiff != 0) - return sdiff > 0 ? 1 : -1; - } + + /* Coded this way to avoid bugs in various versions of gcc. */ + if (h1->root.u.def.value < h2->root.u.def.value) + return -1; + if (h1->root.u.def.value > h2->root.u.def.value) + return 1; + if (h1->root.u.def.section < h2->root.u.def.section) + return -1; + if (h1->root.u.def.section > h2->root.u.def.section) + return 1; + return 0; }