From e5af178fbf5b6b0d317633d4a74b3377ca582c56 Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Thu, 6 Aug 2009 23:25:49 +0000 Subject: [PATCH] 2009-08-06 Paul Pluzhnikov gold/10400 * dwarf2-frame.c (qsort_fde_cmp): Use stable sort. --- gdb/ChangeLog | 5 +++++ gdb/dwarf2-frame.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4fa11597509..d25bd48c916 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-08-06 Paul Pluzhnikov + + gold/10400 + * dwarf2-frame.c (qsort_fde_cmp): Use stable sort. + 2009-08-06 Paul Pluzhnikov * dwarf2-frame.c (struct dwarf2_cie): Remove 'next'. diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 66176591b9a..0f6da4052b4 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; } -- 2.30.2