[gas] Emit v2 .debug_line for -gdwarf-2
commit6cb7f6d92e4508274fab69c7acbbb961fc45dc70
authorTom de Vries <tdevries@suse.de>
Wed, 1 Feb 2023 00:13:37 +0000 (1 01:13 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 1 Feb 2023 00:13:37 +0000 (1 01:13 +0100)
tree7d1a7295249da0e3754665420e3c903e63bfe487
parentdf1d8d2e9118066e8f6ec938c89e179b7cdf7e3d
[gas] Emit v2 .debug_line for -gdwarf-2

Currently, when using -gdwarf-2, gas emits a v3 .debug_line contribution.

Fix this by emitting a v2 .debug_line contribution instead.

gas/ChangeLog:

2023-01-31  Tom de Vries  <tdevries@suse.de>

PR 23941
* dwarf2dbg.c (DWARF2_LINE_VERSION): Set to 2 for -gdwarf-2.
(DWARF2_LINE_OPCODE_BASE): Handle DWARF2_LINE_VERSION == 2.
(dwarf2_directive_loc): Bump dwarf_level when encountering
v3 .loc options.
(out_debug_line): Don't output v3 standard opcodes for v2.
* testsuite/gas/i386/debug1.d: Update.
* testsuite/gas/i386/dwarf2-line-1.d: Update.
* testsuite/gas/i386/dwarf2-line-4.d: Update.
gas/dwarf2dbg.c
gas/testsuite/gas/i386/debug1.d
gas/testsuite/gas/i386/dwarf2-line-1.d
gas/testsuite/gas/i386/dwarf2-line-4.d