+2020-10-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ 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.
+
2020-10-16 Lili Cui <lili.cui@intel.com>
- * config/tc-i386.c: Move Pseudo Prefix check to match_template.
+ * config/tc-i386.c (cpu_flags_match): Move Pseudo Prefix check
+ to ...
+ (match_template): Here.
* testsuite/gas/i386/avx-vnni-inval.l: New file.
* testsuite/gas/i386/avx-vnni-inval.s: Likewise.
* testsuite/gas/i386/avx-vnni.d: Delete invalid {vex2} test.
{
const char * filename;
unsigned int dir;
- bfd_boolean auto_assigned;
unsigned char md5[NUM_MD5_BYTES];
};
}
static bfd_boolean
-assign_file_to_slot (unsigned long i, const char *file, unsigned int dir, bfd_boolean auto_assign)
+assign_file_to_slot (unsigned long i, const char *file, unsigned int dir)
{
if (i >= files_allocated)
{
files[i].filename = file;
files[i].dir = dir;
- files[i].auto_assigned = auto_assign;
memset (files[i].md5, 0, NUM_MD5_BYTES);
if (files_in_use < i + 1)
return i;
}
- if (!assign_file_to_slot (i, file, dir, TRUE))
+ if (!assign_file_to_slot (i, file, dir))
return -1;
last_used = i;
}
fail:
- /* If NUM was previously allocated automatically then
- choose another slot for it, so that we can reuse NUM. */
- if (files[num].auto_assigned)
- {
- /* Find an unused slot. */
- for (i = 1; i < files_in_use; ++i)
- if (files[i].filename == NULL)
- break;
- if (! assign_file_to_slot (i, files[num].filename, files[num].dir, TRUE))
- return FALSE;
- files[num].filename = NULL;
- }
+ /* Reuse NUM if it is 1 and was assigned to the input file before
+ the first .file <NUMBER> directive was seen. */
+ file = as_where_physical (&i);
+ file = get_basename (file);
+ if (num == 1 && filename_cmp (file, files[num].filename) == 0)
+ files[num].filename = NULL;
else
{
as_bad (_("file table slot %u is already occupied by a different file (%s%s%s vs %s%s%s)"),
d = get_directory_table_entry (dirname, dirlen, num == 0);
i = num;
- if (! assign_file_to_slot (i, file, d, FALSE))
+ if (! assign_file_to_slot (i, file, d))
return FALSE;
if (with_md5)
const char *filename;
memset (line, 0, sizeof (*line));
- filename = as_where (&line->line);
+ filename = as_where_physical (&line->line);
line->filenum = allocate_filenum (filename);
/* FIXME: We should check the return value from allocate_filenum. */
line->column = 0;
--- /dev/null
+#as: -gdwarf-5
+#readelf: -wl
+#name: DWARF5 .debug_line 1
+
+Raw dump of debug contents of section \.z?debug_line:
+
+ Offset: 0x0
+ Length: .*
+ DWARF Version: 5
+ Address size \(bytes\): .*
+ Segment selector \(bytes\): 0
+ Prologue Length: .*
+ Minimum Instruction Length: 1
+ Maximum Ops per Instruction: 1
+ Initial value of 'is_stmt': 1
+ Line Base: -5
+ Line Range: 14
+ Opcode Base: 13
+
+ Opcodes:
+ Opcode 1 has 0 args
+ Opcode 2 has 1 arg
+ Opcode 3 has 1 arg
+ Opcode 4 has 1 arg
+ Opcode 5 has 1 arg
+ Opcode 6 has 0 args
+ Opcode 7 has 0 args
+ Opcode 8 has 0 args
+ Opcode 9 has 1 arg
+ Opcode 10 has 0 args
+ Opcode 11 has 0 args
+ Opcode 12 has 1 arg
+
+ The Directory Table \(offset 0x.*, lines 2, columns 1\):
+ Entry Name
+ 0 \(indirect line string, offset: 0x.*\): .*/gas/testsuite/gas/i386
+ 1 \(indirect line string, offset: 0x.*\): .*/gas/testsuite/gas/i386
+
+ The File Name Table \(offset 0x.*, lines 2, columns 3\):
+ Entry Dir MD5 Name
+ 0 0 0xbbd69fc03ce253b2dbaab2522dd519ae \(indirect line string, offset: 0x.*\): core.c
+ 1 0 0x00000000000000000000000000000000 \(indirect line string, offset: 0x.*\): types.h
+
+ Line Number Statements:
+ \[0x.*\] Extended opcode 2: set Address to 0x0
+ \[0x.*\] Special opcode 8: advance Address by 0 to 0x0 and Line by 3 to 4
+ \[0x.*\] Advance PC by 1 to 0x1
+ \[0x.*\] Extended opcode 1: End of Sequence
+
+