Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2015 19:33:35 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r288184 - stable/10/contrib/binutils/gas
Message-ID:  <201509241933.t8OJXZtt002310@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Sep 24 19:33:35 2015
New Revision: 288184
URL: https://svnweb.freebsd.org/changeset/base/288184

Log:
  MFC r256692: Fix .debug_line prologue header length calculation for 64-bit DWARF
  
  The header_length field is the number of bytes following the field to
  the first byte of the line number program.  The hard-coded constants
  previously here (4 + 2 + 4) were correct only for 32-bit DWARF.
  
  Sponsored by:	DARPA, AFRL

Modified:
  stable/10/contrib/binutils/gas/dwarf2dbg.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/binutils/gas/dwarf2dbg.c
==============================================================================
--- stable/10/contrib/binutils/gas/dwarf2dbg.c	Thu Sep 24 19:32:08 2015	(r288183)
+++ stable/10/contrib/binutils/gas/dwarf2dbg.c	Thu Sep 24 19:33:35 2015	(r288184)
@@ -1271,6 +1271,7 @@ out_debug_line (segT line_seg)
   symbolS *line_end;
   struct line_seg *s;
   enum dwarf2_format d2f;
+  int sizeof_initial_length;
   int sizeof_offset;
 
   subseg_set (line_seg, 0);
@@ -1287,27 +1288,24 @@ out_debug_line (segT line_seg)
   d2f = DWARF2_FORMAT ();
   if (d2f == dwarf2_format_32bit)
     {
-      expr.X_add_number = -4;
-      emit_expr (&expr, 4);
-      sizeof_offset = 4;
+      sizeof_initial_length = sizeof_offset = 4;
     }
   else if (d2f == dwarf2_format_64bit)
     {
-      expr.X_add_number = -12;
-      out_four (-1);
-      emit_expr (&expr, 8);
+      sizeof_initial_length = 12;
       sizeof_offset = 8;
+      out_four (-1);
     }
   else if (d2f == dwarf2_format_64bit_irix)
     {
-      expr.X_add_number = -8;
-      emit_expr (&expr, 8);
-      sizeof_offset = 8;
+      sizeof_initial_length = sizeof_offset = 8;
     }
   else
     {
       as_fatal (_("internal error: unknown dwarf2 format"));
     }
+  expr.X_add_number = -sizeof_initial_length;
+  emit_expr (&expr, sizeof_offset);
 
   /* Version.  */
   out_two (2);
@@ -1316,7 +1314,7 @@ out_debug_line (segT line_seg)
   expr.X_op = O_subtract;
   expr.X_add_symbol = prologue_end;
   expr.X_op_symbol = line_start;
-  expr.X_add_number = - (4 + 2 + 4);
+  expr.X_add_number = - (sizeof_initial_length + 2 + sizeof_offset);
   emit_expr (&expr, sizeof_offset);
 
   /* Parameters of the state machine.  */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509241933.t8OJXZtt002310>