diff options
author | Nick Clifton <nickc@redhat.com> | 2004-07-13 12:55:42 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2004-07-13 12:55:42 +0000 |
commit | e6b7d0f2360d654da3ed0feea0e60f0ce4baf9f8 (patch) | |
tree | 99723a4d6987dd39b61d2cadb202dc1f5f3bb165 /bfd/elflink.c | |
parent | 2ef8a0a8c2d6b1c34557b0f96e2c81b32f5d1a25 (diff) | |
download | gdb-e6b7d0f2360d654da3ed0feea0e60f0ce4baf9f8.zip gdb-e6b7d0f2360d654da3ed0feea0e60f0ce4baf9f8.tar.gz gdb-e6b7d0f2360d654da3ed0feea0e60f0ce4baf9f8.tar.bz2 |
(elf_sort_symbol): Restructure code to avoid bug in Solairs hosted versions of
gcc.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 1c1de27..cf7d14e 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; } |