aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authoresmeyi <esme.yi@ibm.com>2023-05-08 00:55:27 -0400
committeresmeyi <esme.yi@ibm.com>2023-05-08 00:55:27 -0400
commit52ae3b5725441dca252c6e7bbbb23fc7c316a591 (patch)
tree7c5a6deb10dc23086e5e0e97308613ffa9acfca9 /llvm/lib/MC/MCDwarf.cpp
parent231ef2104d15c306f0e362db649cf241ac575d09 (diff)
downloadllvm-52ae3b5725441dca252c6e7bbbb23fc7c316a591.zip
llvm-52ae3b5725441dca252c6e7bbbb23fc7c316a591.tar.gz
llvm-52ae3b5725441dca252c6e7bbbb23fc7c316a591.tar.bz2
[DWARF][MC] improve the error message when DwarfLineStrSection is null.
Summary: Currently the crush info is ambiguous when DwarfLineStrSection is null. The patch adds an assertion in the constructor of MCDwarfLineStr when DwarfLineStrSection is null. Reviewed By: shchenz Differential Revision: https://reviews.llvm.org/D149121
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 6acfd08..9506b5c 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -78,9 +78,12 @@ static inline uint64_t ScaleAddrDelta(MCContext &Context, uint64_t AddrDelta) {
MCDwarfLineStr::MCDwarfLineStr(MCContext &Ctx) {
UseRelocs = Ctx.getAsmInfo()->doesDwarfUseRelocationsAcrossSections();
- if (UseRelocs)
- LineStrLabel =
- Ctx.getObjectFileInfo()->getDwarfLineStrSection()->getBeginSymbol();
+ if (UseRelocs) {
+ MCSection *DwarfLineStrSection =
+ Ctx.getObjectFileInfo()->getDwarfLineStrSection();
+ assert(DwarfLineStrSection && "DwarfLineStrSection must not be NULL");
+ LineStrLabel = DwarfLineStrSection->getBeginSymbol();
+ }
}
//