This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

detect special mips64le dwarf2 line number length encoding


The code that was put in to detect the special 64-bit format used by
IRIX (and mips64-linux-gnu) fails in little-endian mode, since what it
reads as the length is actually the lower 32-bit word, that is quite
likely non-zero.  This patch makes the test a bit more inclusive, such
that it can do the detection in little-endian mode.  I hope the
assumption is reasonable.  Ok to install?

Index: bfd/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* dwarf2.c (decode_line_info): Detect special 64-bit address
	format in little-endian mode too.

Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.42
diff -u -p -r1.42 dwarf2.c
--- bfd/dwarf2.c 12 Dec 2002 10:26:01 -0000 1.42
+++ bfd/dwarf2.c 19 Jan 2003 10:49:15 -0000
@@ -1069,10 +1069,14 @@ decode_line_info (unit, stash)
       line_ptr += 8;
       offset_size = 8;
     }
-  else if (lh.total_length == 0 && unit->addr_size == 8)
+  else if (unit->addr_size == 8
+	   /* This should catch both big and little endian.  The
+	      assumption is that version is not going to be zero, and
+	      that the total length fits in 32 bits.  */
+	   && (lh.total_length == 0 || read_4_bytes (abfd, line_ptr) == 0))
     {
       /* Handle (non-standard) 64-bit DWARF2 formats.  */
-      lh.total_length = read_4_bytes (abfd, line_ptr);
+      lh.total_length = read_8_bytes (abfd, line_ptr - 4);
       line_ptr += 4;
       offset_size = 8;
     }
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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