bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/30064] New: gas generates v3 .debug_line contribution with -gdw


From: vries at gcc dot gnu.org
Subject: [Bug gas/30064] New: gas generates v3 .debug_line contribution with -gdwarf-2
Date: Tue, 31 Jan 2023 10:10:27 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30064

            Bug ID: 30064
           Summary: gas generates v3 .debug_line contribution with
                    -gdwarf-2
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider the following test-case:
...
$ gcc-11 -g -gdwarf-2 ~/hello.c -gno-as-loc-support -c
$ readelf -wl hello.o | grep "DWARF Version"
  DWARF Version:               2
...

So we asked gcc to generate v2 dwarf, and it does.

Now let's try the same using .loc directives:
...
$ gcc-11 -g -gdwarf-2 ~/hello.c -gas-loc-support -c
$ readelf -wl hello.o | grep "DWARF Version"
  DWARF Version:               3
...

gcc-11 is new enough to pass -gdwarf-2 to gas, so that's not the problem.

Maybe we're using some extension that bumps the dwarf version to v3 (that seems
to be common practise in gas)?  Let's try again with -gstrict-dwarf:
...
$ gcc-11 -g -gstrict-dwarf -gdwarf-2 ~/hello.c -gas-loc-support -c
$ readelf -wl hello.o | grep "DWARF Version"
  DWARF Version:               3
...
Nope, still 3.

This is due to the fix for PR23941, which hardcodes the version of the
.debug_lines contribution to (minimally) v3.

Perhaps this is a wont-fix, but in that case IWBN if there was a comment here
stating that we ignore -gdwarf-2, and explaining why:
...
/* This implementation outputs version 3 .debug_line information.  */
#ifndef DWARF2_LINE_VERSION
#define DWARF2_LINE_VERSION (dwarf_level > 3 ? dwarf_level : 3)
#endif
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]