[llvm-mc] - Do not crash when referencing undefined debug sections.
authorGeorge Rimar <grimar@accesssoftek.com>
Tue, 4 Dec 2018 10:10:50 +0000 (10:10 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Tue, 4 Dec 2018 10:10:50 +0000 (10:10 +0000)
commit026cc2ff9552fa372bd5a38397fd0866d69fd96d
treec271418de0c24890d04eb89e9bb022ef8f83fdce
parent7e981f330b2f204b3ec4b3b7af90ea3f950af822
[llvm-mc] - Do not crash when referencing undefined debug sections.

MC has code that pre-creates few debug sections:
https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCObjectFileInfo.cpp#L396

If users code has a reference to such section but does not redefine it,
MC code currently asserts, because still thinks they are normally defined.

The patch fixes the issue.

Differential revision: https://reviews.llvm.org/D55173

llvm-svn: 348243
llvm/lib/MC/ELFObjectWriter.cpp
llvm/test/MC/ELF/undefined-debug.s [new file with mode: 0644]