diff options
author | Nick Clifton <nickc@redhat.com> | 2020-03-06 17:13:22 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-03-06 17:13:22 +0000 |
commit | 84d9ab33f3dc542c5f20abb9026240cfd48ccd97 (patch) | |
tree | cbdd933a1952a9f71c90f3e43e0265cb96390995 /gas/dwarf2dbg.c | |
parent | 436b5e99c8eef55433f2c1de35d8f960425aa4c1 (diff) | |
download | binutils-gdb-84d9ab33f3dc542c5f20abb9026240cfd48ccd97.tar.gz |
Add support for a ".file 0" directive if supporting DWARF 5 or higher.
PR 25614
* dwarf2dbg.c (dwarf2_directive_filename): Allow a file number of
0 if the dwarf_level is 5 or more. Complain if a filename follows
a file 0.
* testsuite/gas/elf/dwarf-5-file0.s: New test.
* testsuite/gas/elf/dwarf-5-file0.d: New test driver.
* testsuite/gas/elf/elf.exp: Run the new test.
PR 25612
* config/tc-ia64.h (DWARF2_VERISION): Fix typo.
* doc/as.texi: Fix another typo.
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r-- | gas/dwarf2dbg.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 7384a17c577..181401300e6 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -794,17 +794,27 @@ dwarf2_directive_filename (void) } num = get_absolute_expression (); - filename = demand_copy_C_string (&filename_len); - if (filename == NULL) - return NULL; - demand_empty_rest_of_line (); - if ((offsetT) num < 1) + if ((offsetT) num < 1 && dwarf_level < 5) { as_bad (_("file number less than one")); + ignore_rest_of_line (); return NULL; } + if (num == 0) + { + demand_empty_rest_of_line (); + return NULL; + } + + filename = demand_copy_C_string (&filename_len); + if (filename == NULL) + /* demand_copy_C_string will have already generated an error message. */ + return NULL; + + demand_empty_rest_of_line (); + /* A .file directive implies compiler generated debug information is being supplied. Turn off gas generated debug info. */ debug_type = DEBUG_NONE; @@ -821,7 +831,7 @@ dwarf2_directive_filename (void) return NULL; } - get_filenum (filename, (unsigned int) num); + (void) get_filenum (filename, (unsigned int) num); return filename; } |