aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-07-14 08:53:59 +0000
committerNick Clifton <nickc@redhat.com>2004-07-14 08:53:59 +0000
commit10b7e05bbe71c9346717e68a32873f6da53e5647 (patch)
treeefc7d1ad9303947b4fb1887980d2f4a9c4ab2a0a /bfd/elflink.c
parent78c4c9540cb4be1f09fd06f4575c9d6f8570daa6 (diff)
downloadgdb-10b7e05bbe71c9346717e68a32873f6da53e5647.zip
gdb-10b7e05bbe71c9346717e68a32873f6da53e5647.tar.gz
gdb-10b7e05bbe71c9346717e68a32873f6da53e5647.tar.bz2
Revert previous delta - the bug had already been fixed.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index cf7d14e..1c1de27 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2733,26 +2733,24 @@ 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;
-
- /* 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;
-
+ 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;
+ }
return 0;
}