[binutils-gdb] dwarf2: Fix calculation of line info offset

Alan Modra amodra@sourceware.org
Wed Mar 13 04:25:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=71250b94dc669b285cddcb744a7b3d1c7e2ec94b

commit 71250b94dc669b285cddcb744a7b3d1c7e2ec94b
Author: Christian Eggers <ceggers@gmx.de>
Date:   Sun Mar 10 19:21:52 2019 +0100

    dwarf2: Fix calculation of line info offset
    
    The units of the value returned by "frag_now_fix()" and "size" do not
    match. "frag_now_fix()" returns bytes (can be 8, 16 or 32 bit), while
    "size" is octets (exactly 8 bit).
    
    	* dwarf2dbg.c (dwarf2_emit_insn): Fix calculation of line info offset.

Diff:
---
 gas/ChangeLog   | 4 ++++
 gas/dwarf2dbg.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 2b8215b..174ff54 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2019-03-13  Christian Eggers  <ceggers@gmx.de>
+
+	* dwarf2dbg.c (dwarf2_emit_insn): Fix calculation of line info offset.
+
 2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>
 
 	* testsuite/gas/s390/zarch-arch13.s: Adjust testcase to optable changes.
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index ff7a743..45d86a6 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -579,7 +579,7 @@ dwarf2_emit_insn (int size)
 
   dwarf2_where (&loc);
 
-  dwarf2_gen_line_info (frag_now_fix () - size, &loc);
+  dwarf2_gen_line_info ((frag_now_fix_octets () - size) / OCTETS_PER_BYTE, &loc);
   dwarf2_consume_line_info ();
 }



More information about the Binutils-cvs mailing list