summaryrefslogtreecommitdiff
path: root/libdwfl/derelocate.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl/derelocate.c')
-rw-r--r--libdwfl/derelocate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index e5c3e12e..2f80b20f 100644
--- a/libdwfl/derelocate.c
+++ b/libdwfl/derelocate.c
@@ -67,7 +67,13 @@ compare_secrefs (const void *a, const void *b)
if ((*p1)->start > (*p2)->start)
return 1;
- return 0;
+ if ((*p1)->end < (*p2)->end)
+ return -1;
+ if ((*p1)->end > (*p2)->end)
+ return 1;
+
+ /* Same start/end, then just compare which section came first. */
+ return elf_ndxscn ((*p1)->scn) - elf_ndxscn ((*p2)->scn);
}
static int