diff options
author | Mark Wielaard <mark@klomp.org> | 2020-09-07 14:25:25 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-09-11 19:18:44 +0200 |
commit | edc7a80a9c04667dfa74f90f74bd39827bc372b7 (patch) | |
tree | 7b3047fb76bf8068810aaed3ee31e2f30bb5d0a4 /gas/doc | |
parent | 548f5275787a2328b5c1ea041e13a53e67d4accb (diff) | |
download | gdb-edc7a80a9c04667dfa74f90f74bd39827bc372b7.zip gdb-edc7a80a9c04667dfa74f90f74bd39827bc372b7.tar.gz gdb-edc7a80a9c04667dfa74f90f74bd39827bc372b7.tar.bz2 |
gas: Don't error when .debug_line already exists, unless .loc was used
When -g was used to generate DWARF gas would error out when a .debug_line
already exists. But when a .debug_info section already exists it would
simply skip generating one without warning or error. Do the same for
.debug_line. It is only an error when the user explicitly uses .loc
directives and also generates the .debug_line table itself.
The tests are unfortunately arch specific because the line table is only
generated when actual instructions have been emitted. Use i386 because
that is probably the most used architecture. Before this patch the new
dwarf-line-2 testcase would fail, with this patch it succeeds (and doesn't
try to add its own line table).
gas/ChangeLog:
* as.texi (-g): Explicitly mention when .debug_info and .debug_line
are generated for the DWARF format.
(Loc): Add that it is an error to both use a .loc directive and
generate a .debug_line yourself.
* dwarf2dbg.c (dwarf2_any_loc_directive_seen): New static variable.
(dwarf2_directive_loc): Set dwarf2_any_loc_directive_seen to TRUE.
(dwarf2_finish): Check dwarf2_any_loc_directive_seen before emitting
an error. Only create .debug_line if it is empty (or doesn't exist).
* testsuite/gas/i386/i386.exp: Add dwarf2-line-{1,2,3,4} when testing
an elf target.
* testsuite/gas/i386/dwarf2-line-{1,2,3,4}.{s,d,l}: New test files.
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/as.texi | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 112eaf8..f2a0314 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -745,7 +745,9 @@ compiler output). @itemx --gen-debug Generate debugging information for each assembler source line using whichever debug format is preferred by the target. This currently means either STABS, -ECOFF or DWARF2. +ECOFF or DWARF2. When the debug format is DWARF then a @code{.debug_info} and +@code{.debug_line} section is only emitted when the assembly file doesn't +generate one itself. @item --gstabs Generate stabs debugging information for each assembler line. This @@ -5857,7 +5859,8 @@ the @code{.loc} directive will add a row to the @code{.debug_line} line number matrix corresponding to the immediately following assembly instruction. The @var{fileno}, @var{lineno}, and optional @var{column} arguments will be applied to the @code{.debug_line} state machine before -the row is added. +the row is added. It is an error for the input assembly file to generate +a non-empty @code{.debug_line} and also use @code{loc} directives. The @var{options} are a sequence of the following tokens in any order: |