]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas: Reuse the input file entry in the file table
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 16 Oct 2020 11:03:20 +0000 (04:03 -0700)
committerMark Wielaard <mark@klomp.org>
Mon, 16 Nov 2020 19:41:54 +0000 (20:41 +0100)
commitea873d892ebfae612aed5d308061b083b3f06636
tree5f8105f91f7846873ce2823518e7e9a64bebad02
parent97cdf5f93459ff85e4e73e4da60d4f76e03187d0
gas: Reuse the input file entry in the file table

Some instructions can be emitted (dwarf2_emit_insn is called) before the
first .file <NUMBER> directive has been seen, which allocates the input
file as the first file entry.  Reuse the input file entry in the file
table.

PR gas/25878
PR gas/26740
* dwarf2dbg.c (file_entry): Remove auto_assigned.
(assign_file_to_slot): Remove the auto_assign argument.
(allocate_filenum): Updated.
(allocate_filename_to_slot): Reuse the input file entry in the
file table.
(dwarf2_where): Replace as_where with as_where_physical.
* testsuite/gas/i386/dwarf5-line-1.d: New file.
* testsuite/gas/i386/dwarf5-line-1.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf5-line-1.

(cherry picked from commit 6915020bb134ae29fd772295c66fd67b5944962d)

gas: Always use as_where for preprocessed assembly codes

Always clear the slot 1 if it was assigned to the input file before the
first .file <NUMBER> directive has been seen.  Always use as_where to
generate the correct debug infor for preprocessed assembly codes.

PR gas/25878
PR gas/26740
* dwarf2dbg.c (allocate_filename_to_slot): Don't reuse the slot 1
here.
(dwarf2_where): Restore as_where.
(dwarf2_directive_filename): Clear the slot 1 if it was assigned
to the input file.
* testsuite/gas/i386/dwarf5-line-2.d: New file.
* testsuite/gas/i386/dwarf5-line-2.s: Likewise.
* testsuite/gas/i386/dwarf5-line-3.d: Likewise.
* testsuite/gas/i386/dwarf5-line-3.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf5-line-2 and
dwarf5-line-3.

(cherry picked from commit bd0c565edbf4ba8121fded38e389530d7fa6f963)

gas: Clear all auto-assigned file slots

Since a file slot is auto-assigned for the #APP marker appeared before
the first .file <NUMBER> directive has been seen, clear all auto-assigned
file slots when seeing the first .file <NUMBER> directive.

PR gas/26778
* * dwarf2dbg.c (num_of_auto_assigned): New.
(allocate_filenum): Increment num_of_auto_assigned.
(dwarf2_directive_filename): Clear the slots auto-assigned
before the first .file <NUMBER> directive was seen.
* testsuite/gas/i386/dwarf4-line-1.d: New file.
* testsuite/gas/i386/dwarf4-line-1.s: Likewise.
* testsuite/gas/i386/i386.exp: Run dwarf4-line-1.

(cherry picked from commit ae9d2233e61a98ff8dba56be10219aa5306ffc9a)
gas/ChangeLog
gas/dwarf2dbg.c
gas/testsuite/gas/i386/dwarf4-line-1.d [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf4-line-1.s [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf5-line-1.d [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf5-line-1.s [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf5-line-2.d [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf5-line-2.s [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf5-line-3.d [new file with mode: 0644]
gas/testsuite/gas/i386/dwarf5-line-3.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp