return IterBool.first->second.Number;
}
-
-void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
+MCSymbol *AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize();
StringRef Prefix = "debug_addr_";
MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start");
- EndLabel = Asm.createTempSymbol(Prefix + "end");
+ MCSymbol *EndLabel = Asm.createTempSymbol(Prefix + "end");
Asm.OutStreamer->AddComment("Length of contribution");
Asm.EmitLabelDifference(EndLabel, BeginLabel,
4); // TODO: Support DWARF64 format.
Asm.emitInt8(AddrSize);
Asm.OutStreamer->AddComment("Segment selector size");
Asm.emitInt8(0); // TODO: Support non-zero segment_selector_size.
+
+ return EndLabel;
}
// Emit addresses into the section given.
// Start the dwarf addr section.
Asm.OutStreamer->SwitchSection(AddrSection);
+ MCSymbol *EndLabel = nullptr;
+
if (Asm.getDwarfVersion() >= 5)
- emitHeader(Asm, AddrSection);
+ EndLabel = emitHeader(Asm, AddrSection);
// Define the symbol that marks the start of the contribution.
// It is referenced via DW_AT_addr_base.
for (const MCExpr *Entry : Entries)
Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
- Asm.OutStreamer->EmitLabel(EndLabel);
+ if (EndLabel)
+ Asm.OutStreamer->EmitLabel(EndLabel);
}
};
DenseMap<const MCSymbol *, AddressPoolEntry> Pool;
- MCSymbol *EndLabel;
-
/// Record whether the AddressPool has been queried for an address index since
/// the last "resetUsedFlag" call. Used to implement type unit fallback - a
/// type that references addresses cannot be placed in a type unit when using
void setLabel(MCSymbol *Sym) { AddressTableBaseSym = Sym; }
private:
- void emitHeader(AsmPrinter &Asm, MCSection *Section);
+ MCSymbol *emitHeader(AsmPrinter &Asm, MCSection *Section);
/// Symbol designates the start of the contribution to the address table.
MCSymbol *AddressTableBaseSym = nullptr;