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]

Re: PR gas/13024: internal error with branch swapping and double .locs


Richard Sandiford wrote:

> This patch instead creates a list of pending line entries.  When
> emitting the current .loc for a given label, we do the same for all
> previous pending .locs.  When we consume the current .loc, we emit all
> earlier pending ones at the end of the current frag.  This preserves the
> current behaviour of the external interface, as used by ia64 and xtensa
> among others.  (I wonder whether they'd actually want to take a list of
> pending .locs, but I'll leave that for the port maintainers to decide.)

This seems to have introduced a regression in handling DWARF3
attributes for double .loc directives.  With code like:

        .file   1 "test.cpp"

        .text
        .loc    1 1 0 prologue_end
        .loc    1 2 0
        nop

we now get a line table:

 Line Number Statements:
  Set prologue_end to true
  Extended opcode 2: set Address to 0x0
  Copy
  Set prologue_end to true
  Special opcode 6: advance Address by 0 to 0x0 and Line by 1 to 2
  Advance PC by 4 to 0x4
  Extended opcode 1: End of Sequence

Note that *both* line table entries are marked as prologue_end,
even though only the first .loc directive has the keyword.

Before your patch, we got instead:

 Line Number Statements:
  Set prologue_end to true
  Extended opcode 2: set Address to 0x0
  Copy
  Special opcode 6: advance Address by 0 to 0x0 and Line by 1 to 2
  Advance PC by 4 to 0x4
  Extended opcode 1: End of Sequence


This seems to be caused by this part of the patch:

> @@ -576,7 +609,7 @@ dwarf2_directive_loc (int dummy ATTRIBUT
>    /* If we see two .loc directives in a row, force the first one to be
>       output now.  */
>    if (dwarf2_loc_directive_seen)
> -    dwarf2_emit_insn (0);
> +    dwarf2_push_line (&current);

The old call to dwarf2_emit_insn used to call down to
dwarf2_consume_line_info which did:

  current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK
                     | DWARF2_FLAG_PROLOGUE_END
                     | DWARF2_FLAG_EPILOGUE_BEGIN);

The new call to dwarf2_push_line doesn't do that any more,
so the DWARF2_FLAG_PROLOGUE_END stays active in current.flags
for the second directive.  Was this effect deliberate?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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