https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124847

            Bug ID: 124847
           Summary: -gdwarf64 emits .debug_line in 32 bit DWARF format
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mehdi.h.business at pm dot me
  Target Milestone: ---

Compiling the following simple program 

int main() {
  return 0;
}

with `gcc -g -gdwarf64` and inspecting the .debug_line section with `readelf -x
.debug_line a.out` and comparing against `readelf  --debug-dump=line a.out` one
finds that the first four bytes are not 0xffffffff as the DWARF spec mandates
they should be in the 64 bit DWARF format. Likewise the header_length is also 4
bytes rather than 8.

I've only been looking through the codebase for a day so I don't know if this
is useful, but it appears after looking through with gdb no codepath in
dwarf2out.cc dwarf2out_finish calls output_line_info, which *does* appear to
handle outputting the correct initial length.

Admittedly the use case for 64 bit DWARF is negligible but as someone writing a
DWARF consumer this caught me off guard, especially since this was done
silently so I assume this isn't intended behavior.

Reply via email to