[Bug debug/98765] [11 Regression] stripping of LTO debug sections doesn't work anymore since switch to -gdwarf-5 by default

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 20 17:58:03 GMT 2021


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

--- Comment #4 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:27c792895bd809115c1f70672835b7fdff74d318

commit r11-6820-g27c792895bd809115c1f70672835b7fdff74d318
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 20 18:51:04 2021 +0100

    debug: Fix up DWARF 5 -g -flto -ffat-lto-objects [PR98765]

    As mentioned in the PR, with -gdwarf-5 (or -g now) -flto -ffat-lto-objects,
    users can't strip the LTO sections with
    strip -p -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1
    anymore when GCC is configured against recent binutils.

    The problem is that in that case .gnu.debuglto_.debug_line_str section is
    then used, which is fine for references to strings in .gnu.debuglto_.*
    sections, but not when those references are in .debug_info section too;
    those should really reference separate strings in .debug_line_str section.

    For .gnu.debuglto_.debug_str vs. .debug_str we handle it right, we
    reset_indirect_string the strings and thus force creation of new labels for
    the second time.
    But for DW_FORM_line_strp as the patch shows, there were multiple problems.
    First one was that reset_indirect_string, even when called through traverse
    on debug_line_str_hash, didn't do anything at all (fixed by first hunk).
    The second bug was that the DW_FORM_line_strp strings, which were supposed
    to be only visible through debug_line_str_hash, leaked into debug_str_hash
    (second hunk).
    And the third thing is that when we reset debug_line_str_hash, we should
    still make those strings DW_FORM_line_strp if they are accessed.
    One could do it by reinstantiating DW_FORM_line_strp right away in
    reset_indirect_string and not clear debug_line_str_hash, but that has the
    disadvantage that we then force emitting .debug_line_str strings that
aren't
    really needed - we need those from the CU DIEs' DW_AT_name and
    DW_AT_comp_dir attributes, but when emitting .debug_line section through
    assembler, we don't need to emit the strings we only needed for
    .gnu.debuglto_.debug_line which is always emitted by the compiler.

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

            PR debug/98765
            * dwarf2out.c (reset_indirect_string): Also reset indirect strings
            with DW_FORM_line_strp form.
            (prune_unused_types_update_strings): Don't add into debug_str_hash
            indirect strings with DW_FORM_line_strp form.
            (adjust_name_comp_dir): New function.
            (dwarf2out_finish): Call it on CU DIEs after resetting
            debug_line_str_hash.


More information about the Gcc-bugs mailing list