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 /COPYING.NEWLIB | |
parent | 548f5275787a2328b5c1ea041e13a53e67d4accb (diff) | |
download | binutils-edc7a80a9c04667dfa74f90f74bd39827bc372b7.zip binutils-edc7a80a9c04667dfa74f90f74bd39827bc372b7.tar.gz binutils-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 'COPYING.NEWLIB')
0 files changed, 0 insertions, 0 deletions