public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/98796] New: Incorrect .debug_line emitted for DWARF5
@ 2021-01-22 14:19 jakub at gcc dot gnu.org
  2021-01-22 14:19 ` [Bug debug/98796] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-22 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98796
           Summary: Incorrect .debug_line emitted for DWARF5
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

GCC emits incorrect DWARF5 on empty translation units.
> empty.c
gcc -S -gdwarf-5 -dA empty.c -o empty.s -gno-as-loc-support
or
gcc -S -gdwarf-5 -dA empty.c -o empty.s -flto -ffat-lto-objects
emits

        .byte   0       # Directory entry format count
        .uleb128 0      # Directories count
        .byte   0       # File name entry format count
        .uleb128 0      # File names count
at the end of .debug_line or .gnu.debuglto_.debug_line sections.
The DWARF5 specification says:
"The first entry is the current directory of the compilation."
and
"The first entry in the sequence is the primary source file whose file name
exactly matches that given in the DW_AT_name attribute in the compilation unit
debugging information entry."
which is not honored when no directory and file name entries are provided.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/98796] Incorrect .debug_line emitted for DWARF5
  2021-01-22 14:19 [Bug debug/98796] New: Incorrect .debug_line emitted for DWARF5 jakub at gcc dot gnu.org
@ 2021-01-22 14:19 ` jakub at gcc dot gnu.org
  2021-01-22 14:39 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-22 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-22
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/98796] Incorrect .debug_line emitted for DWARF5
  2021-01-22 14:19 [Bug debug/98796] New: Incorrect .debug_line emitted for DWARF5 jakub at gcc dot gnu.org
  2021-01-22 14:19 ` [Bug debug/98796] " jakub at gcc dot gnu.org
@ 2021-01-22 14:39 ` jakub at gcc dot gnu.org
  2021-01-22 21:38 ` cvs-commit at gcc dot gnu.org
  2021-01-22 21:40 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-22 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50034
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50034&action=edit
gcc11-pr98796.patch

Untested fix.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/98796] Incorrect .debug_line emitted for DWARF5
  2021-01-22 14:19 [Bug debug/98796] New: Incorrect .debug_line emitted for DWARF5 jakub at gcc dot gnu.org
  2021-01-22 14:19 ` [Bug debug/98796] " jakub at gcc dot gnu.org
  2021-01-22 14:39 ` jakub at gcc dot gnu.org
@ 2021-01-22 21:38 ` cvs-commit at gcc dot gnu.org
  2021-01-22 21:40 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-22 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:b485fa167ef35c8facbd7c21cb86fd1abc77efcf

commit r11-6868-gb485fa167ef35c8facbd7c21cb86fd1abc77efcf
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 22 22:37:36 2021 +0100

    dwarf2out: Always emit required 0 entries for DWARF 5 in *.debug_line
[PR98796]

    When GCC is emitting .debug_line or .gnu.debuglto_.debug_line section by
    itself (happens either with too old or non-GNU assembler, with
    -gno-as-loc-support or with -flto) on empty translation units, it violates
    the DWARF 5 requirements.
    The standard says:
    "The first entry is the current directory of the compilation."
    and a few lines later:
    "The first entry in the sequence is the primary source file whose file name
    exactly matches that given in the DW_AT_name attribute in the compilation
    unit debugging information entry."
    GCC emits 4 zeros (directory entry format count, directories count,
    filename entry format count and filename count), which would be ok if the
    spec said The first entry may be rather than is.

    I had a brief look at whether I could just fall through into the rest of
the
    function, but there are too many assumptions that there is at least one
    normal file that it can't be done that way easily.

    So this patch instead extends the early out code to emit the required
    minimum, which is 15 bytes more than we used to emit before.

    2021-01-22  Jakub Jelinek  <jakub@redhat.com>

            PR debug/98796
            * dwarf2out.c (output_file_names): For -gdwarf-5, if there are no
            filenames to emit, still emit the required 0 index directory and
            filename entries that match DW_AT_comp_dir and DW_AT_name of the
            compilation unit.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug debug/98796] Incorrect .debug_line emitted for DWARF5
  2021-01-22 14:19 [Bug debug/98796] New: Incorrect .debug_line emitted for DWARF5 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-22 21:38 ` cvs-commit at gcc dot gnu.org
@ 2021-01-22 21:40 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-22 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-22 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 14:19 [Bug debug/98796] New: Incorrect .debug_line emitted for DWARF5 jakub at gcc dot gnu.org
2021-01-22 14:19 ` [Bug debug/98796] " jakub at gcc dot gnu.org
2021-01-22 14:39 ` jakub at gcc dot gnu.org
2021-01-22 21:38 ` cvs-commit at gcc dot gnu.org
2021-01-22 21:40 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).