aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-08-01 16:10:42 +0000
committerNick Clifton <nickc@redhat.com>2001-08-01 16:10:42 +0000
commit00a7cdc55ae2984c6323667e947cdfbd4bba4d6d (patch)
treed4dd5457e1ec5ee6fecd49e2ce2d6c129cafa29f /bfd/elf.c
parentc7c55b785dc640ef7666b35ab77153459e491e9b (diff)
downloadgdb-00a7cdc55ae2984c6323667e947cdfbd4bba4d6d.zip
gdb-00a7cdc55ae2984c6323667e947cdfbd4bba4d6d.tar.gz
gdb-00a7cdc55ae2984c6323667e947cdfbd4bba4d6d.tar.bz2
Return zero only as the last step of qsort function.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 4e2d7ae..8dc2f31 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2677,18 +2677,22 @@ elf_sort_sections (arg1, arg2)
if (TOEND (sec1))
{
if (TOEND (sec2))
- return sec1->target_index - sec2->target_index;
+ {
+ /* If the indicies are the same, do not return 0
+ here, but continue to try the next comparison. */
+ if (sec1->target_index - sec2->target_index != 0)
+ return sec1->target_index - sec2->target_index;
+ }
else
return 1;
}
-
- if (TOEND (sec2))
+ else if (TOEND (sec2))
return -1;
#undef TOEND
- /* Sort by size, to put zero sized sections before others at the
- same address. */
+ /* Sort by size, to put zero sized sections
+ before others at the same address. */
if (sec1->_raw_size < sec2->_raw_size)
return -1;