Fix build - follow-up to r350048 which broke headerless (v4) address pool

llvm-svn: 350050
This commit is contained in:
David Blaikie 2018-12-24 07:56:40 +00:00
parent edabb9ae56
commit 5353e64935
2 changed files with 10 additions and 8 deletions

View File

@ -24,12 +24,11 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
return IterBool.first->second.Number; return IterBool.first->second.Number;
} }
MCSymbol *AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize(); static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize();
StringRef Prefix = "debug_addr_"; StringRef Prefix = "debug_addr_";
MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start"); MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start");
EndLabel = Asm.createTempSymbol(Prefix + "end"); MCSymbol *EndLabel = Asm.createTempSymbol(Prefix + "end");
Asm.OutStreamer->AddComment("Length of contribution"); Asm.OutStreamer->AddComment("Length of contribution");
Asm.EmitLabelDifference(EndLabel, BeginLabel, Asm.EmitLabelDifference(EndLabel, BeginLabel,
4); // TODO: Support DWARF64 format. 4); // TODO: Support DWARF64 format.
@ -40,6 +39,8 @@ void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
Asm.emitInt8(AddrSize); Asm.emitInt8(AddrSize);
Asm.OutStreamer->AddComment("Segment selector size"); Asm.OutStreamer->AddComment("Segment selector size");
Asm.emitInt8(0); // TODO: Support non-zero segment_selector_size. Asm.emitInt8(0); // TODO: Support non-zero segment_selector_size.
return EndLabel;
} }
// Emit addresses into the section given. // Emit addresses into the section given.
@ -50,8 +51,10 @@ void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
// Start the dwarf addr section. // Start the dwarf addr section.
Asm.OutStreamer->SwitchSection(AddrSection); Asm.OutStreamer->SwitchSection(AddrSection);
MCSymbol *EndLabel = nullptr;
if (Asm.getDwarfVersion() >= 5) if (Asm.getDwarfVersion() >= 5)
emitHeader(Asm, AddrSection); EndLabel = emitHeader(Asm, AddrSection);
// Define the symbol that marks the start of the contribution. // Define the symbol that marks the start of the contribution.
// It is referenced via DW_AT_addr_base. // It is referenced via DW_AT_addr_base.
@ -69,5 +72,6 @@ void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
for (const MCExpr *Entry : Entries) for (const MCExpr *Entry : Entries)
Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize()); Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
Asm.OutStreamer->EmitLabel(EndLabel); if (EndLabel)
Asm.OutStreamer->EmitLabel(EndLabel);
} }

View File

@ -30,8 +30,6 @@ class AddressPool {
}; };
DenseMap<const MCSymbol *, AddressPoolEntry> Pool; DenseMap<const MCSymbol *, AddressPoolEntry> Pool;
MCSymbol *EndLabel;
/// Record whether the AddressPool has been queried for an address index since /// Record whether the AddressPool has been queried for an address index since
/// the last "resetUsedFlag" call. Used to implement type unit fallback - a /// the last "resetUsedFlag" call. Used to implement type unit fallback - a
/// type that references addresses cannot be placed in a type unit when using /// type that references addresses cannot be placed in a type unit when using
@ -57,7 +55,7 @@ public:
void setLabel(MCSymbol *Sym) { AddressTableBaseSym = Sym; } void setLabel(MCSymbol *Sym) { AddressTableBaseSym = Sym; }
private: private:
void emitHeader(AsmPrinter &Asm, MCSection *Section); MCSymbol *emitHeader(AsmPrinter &Asm, MCSection *Section);
/// Symbol designates the start of the contribution to the address table. /// Symbol designates the start of the contribution to the address table.
MCSymbol *AddressTableBaseSym = nullptr; MCSymbol *AddressTableBaseSym = nullptr;