[LLD] - Do not crash when reporting errors when .debug_line_str (DWARF5) is used
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 3 Oct 2018 08:59:46 +0000 (08:59 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 3 Oct 2018 08:59:46 +0000 (08:59 +0000)
commit3832d7c25df912a08816d7df30d98a23442452b1
tree06e4cd7b08d812526dfdb10f39a0282199cb10b7
parent2c4079c090aa05dc542169bbc0c3e4b31c6920e9
[LLD] - Do not crash when reporting errors when .debug_line_str (DWARF5) is used

Imagine we have the following code:

int foo();
int main() { return foo(); }

It will crash if you try to compile it with
`clang -O0 -gdwarf-5 test.cpp -o test -g -fuse-ld=lld`

The crash happens inside the LLVM DWARF parser because LLD does not provide
the .debug_line_str section. At the same time for correct parsing and reporting,
we anyways need to provide this section from our side.

The patch fixes the issue.

llvm-svn: 343667
lld/ELF/DWARF.cpp
lld/ELF/DWARF.h
lld/test/ELF/debug-line-str.s [new file with mode: 0644]