File tree Expand file tree Collapse file tree 2 files changed +20
-13
lines changed Expand file tree Collapse file tree 2 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 1+ 2021-01-21 Alan Modra <amodra@gmail.com>
2+
3+ PR 27218
4+ * dwarf2dbg.c (dwarf2_gen_line_info): Correct setting of dwarf_level.
5+ (dwarf2_directive_filename, dwarf2_directive_loc): Likewise, and
6+ error for negative file numbers.
7+
182021-01-18 H.J. Lu <hongjiu.lu@intel.com>
29
310 PR gas/27195
Original file line number Diff line number Diff line change @@ -550,9 +550,10 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc)
550550 /* Early out for as-yet incomplete location information. */
551551 if (loc -> line == 0 )
552552 return ;
553- if (loc -> filenum == 0 && DWARF2_LINE_VERSION < 5 )
553+ if (loc -> filenum == 0 )
554554 {
555- dwarf_level = 5 ;
555+ if (dwarf_level < 5 )
556+ dwarf_level = 5 ;
556557 if (DWARF2_LINE_VERSION < 5 )
557558 return ;
558559 }
@@ -1046,10 +1047,11 @@ dwarf2_directive_filename (void)
10461047
10471048 num = get_absolute_expression ();
10481049
1049- if ((offsetT ) num < 1 && DWARF2_LINE_VERSION < 5 )
1050+ if ((offsetT ) num < 1 )
10501051 {
1051- dwarf_level = 5 ;
1052- if (DWARF2_LINE_VERSION < 5 )
1052+ if (num == 0 && dwarf_level < 5 )
1053+ dwarf_level = 5 ;
1054+ if ((offsetT ) num < 0 || DWARF2_LINE_VERSION < 5 )
10531055 {
10541056 as_bad (_ ("file number less than one" ));
10551057 ignore_rest_of_line ();
@@ -1149,18 +1151,16 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
11491151
11501152 if (filenum < 1 )
11511153 {
1152- if (filenum != 0 || DWARF2_LINE_VERSION < 5 )
1154+ if (filenum == 0 && dwarf_level < 5 )
1155+ dwarf_level = 5 ;
1156+ if (filenum < 0 || DWARF2_LINE_VERSION < 5 )
11531157 {
1154- dwarf_level = 5 ;
1155- if (DWARF2_LINE_VERSION < 5 )
1156- {
1157- as_bad (_ ("file number less than one" ));
1158- return ;
1159- }
1158+ as_bad (_ ("file number less than one" ));
1159+ return ;
11601160 }
11611161 }
11621162
1163- if (filenum >= ( int ) files_in_use || files [filenum ].filename == NULL )
1163+ if (( valueT ) filenum >= files_in_use || files [filenum ].filename == NULL )
11641164 {
11651165 as_bad (_ ("unassigned file number %ld" ), (long ) filenum );
11661166 return ;
You can’t perform that action at this time.
0 commit comments