Bug 28095 - --strip-debug-non-line doesn't work with dwarf-5
Summary: --strip-debug-non-line doesn't work with dwarf-5
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
Depends on:
Reported: 2021-07-15 15:09 UTC by Tom de Vries
Modified: 2021-07-16 12:33 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2021-07-15 15:09:06 UTC
As reported here (PR28094 comment 4):
$ PATH=~/binutils/install/bin:$PATH gcc -fuse-ld=gold -Wl,--strip-debug-non-line hello.c -g -gdwarf-5
/home/vries/binutils/install/bin/ld.gold: warning: Invalid DIE in debug info; failed to reduce debug info
/home/vries/binutils/install/bin/ld.gold: internal error in finalize_data_size, at /home/vries/binutils/src/gold/output.h:355
collect2: error: ld returned 1 exit status
Comment 1 Tom de Vries 2021-07-16 12:33:47 UTC
I guess there are two ways to go about this:
1. now that the implicit dependency of .debug_line on .debug_info is gone in dwarf 5, we can just drop all but .debug_line and .debug_line_str for dwarf 5 CUs.  That will require changes though in existing consumers, like gdb (PR28094), which currently require a .debug_info section.
2. do mostly the same for dwarf 5 as for dwarf 4.  More work in gold, but doesn't require changes in existing consumers (other than regular dwarf 5 support).