V2 [PATCH] gas: Clear all auto-assigned file slots

H.J. Lu hjl.tools@gmail.com
Sat Oct 24 01:55:49 GMT 2020


On Fri, Oct 23, 2020 at 1:06 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Fri, Oct 23, 2020 at 12:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > 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 (file_entry): Restore auto_assigned.
> >         (assign_file_to_slot): Restore the auto_assign argument.
> >         (allocate_filenum): Pass TRUE to file_entry.
> >         (allocate_filename_to_slot): Pass FALSE to file_entry.
> >         (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.
>
> The updated patch with some optimization.  OK for master?
>

Fix a bug:

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 96f79c743f8..4c7f552b968 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1093,6 +1093,7 @@ dwarf2_directive_filename (void)
   if (files[i].auto_assigned)
     files[i].filename = NULL;
       files_in_use -= num_of_auto_assigned;
+      num_of_auto_assigned = 0;
     }

   if (! allocate_filename_to_slot (dirname, filename, (unsigned int) num,


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gas-Clear-all-auto-assigned-file-slots.patch
Type: text/x-patch
Size: 6497 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20201023/69ad8cf7/attachment-0001.bin>


More information about the Binutils mailing list