public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* gas emits incorrect .debug_line prologue header length for 64-bit DWARF
@ 2014-02-27 18:03 Ed Maste
  2014-02-28  4:38 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Ed Maste @ 2014-02-27 18:03 UTC (permalink / raw)
  To: binutils

The header_length field is supposed to be the number of bytes
following the field to the first byte of the line number program, but
dwarf2dbg.c:out_debug_line has hard-coded constants that are correct
only for 32-bit DWARF.

I've fixed it in FreeBSD here in SVN r256692:
http://svnweb.freebsd.org/base?view=revision&revision=256692

-Ed

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gas emits incorrect .debug_line prologue header length for 64-bit DWARF
  2014-02-27 18:03 gas emits incorrect .debug_line prologue header length for 64-bit DWARF Ed Maste
@ 2014-02-28  4:38 ` Alan Modra
  2014-02-28 17:52   ` Ed Maste
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2014-02-28  4:38 UTC (permalink / raw)
  To: Ed Maste; +Cc: binutils

On Thu, Feb 27, 2014 at 01:03:23PM -0500, Ed Maste wrote:
> The header_length field is supposed to be the number of bytes
> following the field to the first byte of the line number program, but
> dwarf2dbg.c:out_debug_line has hard-coded constants that are correct
> only for 32-bit DWARF.
> 
> I've fixed it in FreeBSD here in SVN r256692:
> http://svnweb.freebsd.org/base?view=revision&revision=256692

Thanks for the heads-up.  I'm committing the following to mainline
that calculates the length as a simple difference of two symbols.

	* dwarf2dbg.c (out_debug_line): Correct .debug_line header_length
	field for 64-bit dwarf.

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 6d6ee2d..ac6148f 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1515,7 +1515,7 @@ static void
 out_debug_line (segT line_seg)
 {
   expressionS exp;
-  symbolS *prologue_end;
+  symbolS *prologue_start, *prologue_end;
   symbolS *line_end;
   struct line_seg *s;
   int sizeof_offset;
@@ -1527,10 +1527,14 @@ out_debug_line (segT line_seg)
   out_two (DWARF2_LINE_VERSION);
 
   /* Length of the prologue following this length.  */
+  prologue_start = symbol_temp_make ();
   prologue_end = symbol_temp_make ();
+  exp.X_op = O_subtract;
   exp.X_add_symbol = prologue_end;
-  exp.X_add_number = - (4 + 2 + 4);
+  exp.X_op_symbol = prologue_start;
+  exp.X_add_number = 0;
   emit_expr (&exp, sizeof_offset);
+  symbol_set_value_now (prologue_start);
 
   /* Parameters of the state machine.  */
   out_byte (DWARF2_LINE_MIN_INSN_LENGTH);

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gas emits incorrect .debug_line prologue header length for 64-bit DWARF
  2014-02-28  4:38 ` Alan Modra
@ 2014-02-28 17:52   ` Ed Maste
  2014-03-01 22:17     ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Ed Maste @ 2014-02-28 17:52 UTC (permalink / raw)
  To: Ed Maste, binutils

On 27 February 2014 23:38, Alan Modra <amodra@gmail.com> wrote:
> Thanks for the heads-up.  I'm committing the following to mainline
> that calculates the length as a simple difference of two symbols.
>
>         * dwarf2dbg.c (out_debug_line): Correct .debug_line header_length
>         field for 64-bit dwarf.

Thanks.  Can I commit this version to the FreeBSD in-tree binutils under GPLv2?

-Ed

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gas emits incorrect .debug_line prologue header length for 64-bit DWARF
  2014-02-28 17:52   ` Ed Maste
@ 2014-03-01 22:17     ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2014-03-01 22:17 UTC (permalink / raw)
  To: Ed Maste; +Cc: binutils

On Fri, Feb 28, 2014 at 12:52:04PM -0500, Ed Maste wrote:
> On 27 February 2014 23:38, Alan Modra <amodra@gmail.com> wrote:
> > Thanks for the heads-up.  I'm committing the following to mainline
> > that calculates the length as a simple difference of two symbols.
> >
> >         * dwarf2dbg.c (out_debug_line): Correct .debug_line header_length
> >         field for 64-bit dwarf.
> 
> Thanks.  Can I commit this version to the FreeBSD in-tree binutils under GPLv2?
Yes.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-01 22:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27 18:03 gas emits incorrect .debug_line prologue header length for 64-bit DWARF Ed Maste
2014-02-28  4:38 ` Alan Modra
2014-02-28 17:52   ` Ed Maste
2014-03-01 22:17     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).