[Bug debug/108600] Use DW_LNS_set_prologue_end

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 31 10:15:20 GMT 2023


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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> (In reply to Tom de Vries from comment #1)
> > Created attachment 54371 [details]
> 
> We probably don't want to emit in all cases, maybe limiting to 
> "dwarf_version >= 3", or "!dwarf_strict || dwarf_version >= 3".

Let's see about dwarf_strict.

Semantics:
...
-gstrict-dwarf

    Disallow using extensions of later DWARF standard version than selected
with -gdwarf-version. On most targets using non-conflicting DWARF extensions
from later standard versions is allowed.
...

For the -gas-loc-support case (gcc emitting .locs), even when passing
-gdwarf-2, gas emits a v3 version .debug_line section (since binutils-2_32). 
And even if we'd fix that (I've filed
https://sourceware.org/bugzilla/show_bug.cgi?id=30064), the way gas works is by
bumping the dwarf version when encountering a feature that requires a higher
version, so using end_prologue in a loc directive would then end up bumping
dwarf_level to 3, bumping also the .debug_line version.

For the -gno-as-loc-support case (gcc emitting .debug_line contribution), for
-gdwarf-2 gcc indeed emits a v2 .debug_line section.  But, that makes
DW_LNS_set_prologue_end fall in the range of vendor specific extensions, and we
can't conflict with that.

Taking this all into account, I think it's better not to emit
DW_LNS_set_prologue_end for -gdwarf-2 -gno-strict-dwarf.


More information about the Gcc-bugs mailing list