aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2-frame.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2009-08-06 23:25:49 +0000
committerPaul Pluzhnikov <ppluzhnikov@google.com>2009-08-06 23:25:49 +0000
commite5af178fbf5b6b0d317633d4a74b3377ca582c56 (patch)
treead6a406b2bf0ee39a302d75035f3d9f77a8c02d9 /gdb/dwarf2-frame.c
parentb01c84103b9aeb50d2c34d2e562579b79a0c604c (diff)
downloadgdb-e5af178fbf5b6b0d317633d4a74b3377ca582c56.zip
gdb-e5af178fbf5b6b0d317633d4a74b3377ca582c56.tar.gz
gdb-e5af178fbf5b6b0d317633d4a74b3377ca582c56.tar.bz2
2009-08-06 Paul Pluzhnikov <ppluzhnikov@google.com>
gold/10400 * dwarf2-frame.c (qsort_fde_cmp): Use stable sort.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r--gdb/dwarf2-frame.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 6617659..0f6da40 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1958,9 +1958,18 @@ qsort_fde_cmp (const void *a, const void *b)
{
struct dwarf2_fde *aa = *(struct dwarf2_fde **)a;
struct dwarf2_fde *bb = *(struct dwarf2_fde **)b;
+
if (aa->initial_location == bb->initial_location)
- /* Put eh_frame entries after debug_frame ones. */
- return aa->eh_frame_p - bb->eh_frame_p;
+ {
+ if (aa->address_range != bb->address_range
+ && aa->eh_frame_p == 0 && bb->eh_frame_p == 0)
+ /* Linker bug, e.g. gold/10400.
+ Work around it by keeping stable sort order. */
+ return (a < b) ? -1 : 1;
+ else
+ /* Put eh_frame entries after debug_frame ones. */
+ return aa->eh_frame_p - bb->eh_frame_p;
+ }
return (aa->initial_location < bb->initial_location) ? -1 : 1;
}