This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][patch] Work around for gold/10400 bug.


Greetings,

Perhaps I am jumping the gun here, but I'd like some comments on this
patch as well.

The patch below is on top of my earlier 'speedup find_fde' patch:

  http://sourceware.org/ml/gdb-patches/2009-07/msg00528.html

and works around the gold/10400 issue:

  http://sourceware.org/bugzilla/show_bug.cgi?id=10400

by using the first FDE entry when there are incompatible FDEs "covering"
the same code region. The first entry exactly corresponds to the COMDAT
section gold actually selected, and is the right one to use.

[Gold issue has been fixed, but it will be quite a while before I can pick
up that fix, and it would be nice to have a GDB workaround.]

Tested on Linux/x86_64 with no new failures.

Comments?

Thanks,
--
Paul Pluzhnikov

2009-07-21  Paul Pluzhnikov  <ppluzhnikov@google.com>

	gold/10400
	* dwarf2-frame.c (qsort_fde_cmp): Use stable sort.


Index: src/gdb/dwarf2-frame.c
===================================================================
--- src.orig/gdb/dwarf2-frame.c	2009-07-21 16:33:41.000000000 -0700
+++ src/gdb/dwarf2-frame.c	2009-07-21 16:43:46.000000000 -0700
@@ -1955,8 +1955,16 @@
   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 (char *) a - (char *) b;
+      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;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]