diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp --- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp @@ -582,7 +582,9 @@ StringPool->emit(*Asm, TLOF->getDwarfStrSection(), TLOF->getDwarfStrOffSection()); - AddressPool.emit(*Asm, TLOF->getDwarfAddrSection(), AddrTableStartSym); + // Some targets might not have dwarf address section. + if (MCSection *AddrSection = TLOF->getDwarfAddrSection()) + AddressPool.emit(*Asm, AddrSection, AddrTableStartSym); MS->switchSection(TLOF->getDwarfInfoSection()); for (auto &CU : CompileUnits) {