This is the mail archive of the binutils@sourceware.org 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]

[PATCH] A 64-bit address does not imply 64-bit DWARF2 offsets.


This patch fixes addr2line on mips64el-none-linux-gnu (-mabi=64 e.g.
N64).

DWARF2 64-bit offsets are very rarely used (being only of use if you
have more than 2GB of debug info) and GCC will only ever generate them
with DWARF3 or IRIX conventions so the current default is generally
wrong for GCC on 64-bit targets. In the abscence of any hints we should
assume 32-bit offsets even if addr_size is 64-bits.

No regressions on x86_64-unknown-linux-gnu, or mips64el-none-linux-gnu.

OK to checkin?

Cheers,
Carlos.
-- 
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716

2007-02-21  Carlos O'Donell  <carlos@codesourcery.com>

	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Assume 32-bit
	DWARF even with 64-bit addresses.
	(_bfd_dwarf2_find_nearest_line): Likewise.

Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.91
diff -u -p -r1.91 dwarf2.c
--- bfd/dwarf2.c	17 Sep 2006 02:44:38 -0000	1.91
+++ bfd/dwarf2.c	21 Feb 2007 17:03:52 -0000
@@ -2469,13 +2469,12 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd
 	  length = read_4_bytes (abfd, stash->info_ptr + 4);
 	  stash->info_ptr += 8;
 	}
-      /* In the absence of the hints above, we assume addr_size-sized
-	 offsets, for backward-compatibility with pre-DWARF3 64-bit
-	 platforms.  */
+      /* In the absence of the hints above, we assume 32-bit DWARF2
+	 offsets even with 64-bit addresses.  */
       else if (addr_size == 8)
 	{
-	  length = read_8_bytes (abfd, stash->info_ptr);
-	  stash->info_ptr += 8;
+	  offset_size = 4;
+          stash->info_ptr += 4;
 	}
       else
 	stash->info_ptr += 4;
@@ -2692,13 +2691,12 @@ _bfd_dwarf2_find_line (bfd *abfd,
 	  length = read_4_bytes (abfd, stash->info_ptr + 4);
 	  stash->info_ptr += 8;
 	}
-      /* In the absence of the hints above, we assume addr_size-sized
-	 offsets, for backward-compatibility with pre-DWARF3 64-bit
-	 platforms.  */
+      /* In the absence of the hints above, we assume 32-bit DWARF2
+	 offsets even with 64-bit addresses.  */
       else if (addr_size == 8)
 	{
-	  length = read_8_bytes (abfd, stash->info_ptr);
-	  stash->info_ptr += 8;
+	  offset_size = 4;
+          stash->info_ptr += 4;
 	}
       else
 	stash->info_ptr += 4;


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