This is one more attempt to re-land patch r289925 that was reverted by Nico a while ago (because it caused problem for Chromium's symbolizer).
Nico filed a bug PR# 31407, https://bugs.llvm.org/show_bug.cgi?id=31407, but unfortunately, the reproducer was not created for several months.
A couple of days ago Caroline confirmed that the problem was with the symbolizer, not with the patch itself. See all the details in PR# 31407.
So now I could re-submit the patch again.
I rebased my old patch (https://reviews.llvm.org/D16697) and made a few small changes. Namely, I updated debug_line table length/prologue length for some of newly added tests
and temporarily lowered the line table version to 2, when generation of DWARF V5 is requested (simply because line table V5 is not supported yet and a lot of newly added DWARF 5 tests started to fail).