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
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).