Index: include/llvm/CodeGen/AsmPrinter.h =================================================================== --- include/llvm/CodeGen/AsmPrinter.h +++ include/llvm/CodeGen/AsmPrinter.h @@ -508,8 +508,13 @@ /// When possible, emit a DwarfStringPool section offset without any /// relocations, and without using the symbol. Otherwise, defers to \a /// emitDwarfSymbolReference(). - void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const; + void emitDwarfStringOffset(DwarfStringPoolEntry S) const; + /// Emit the 4-byte offset of a string from the start of its section. + void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const { + emitDwarfStringOffset(S.getEntry()); + } + /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified. virtual unsigned getISAEncoding() { return 0; } Index: include/llvm/CodeGen/DwarfStringPoolEntry.h =================================================================== --- include/llvm/CodeGen/DwarfStringPoolEntry.h +++ include/llvm/CodeGen/DwarfStringPoolEntry.h @@ -41,6 +41,7 @@ unsigned getOffset() const { return I->second.Offset; } unsigned getIndex() const { return I->second.Index; } StringRef getString() const { return I->first(); } + DwarfStringPoolEntry getEntry() const { return I->getValue(); } bool operator==(const DwarfStringPoolEntryRef &X) const { return I == X.I; } bool operator!=(const DwarfStringPoolEntryRef &X) const { return I != X.I; } Index: lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -167,14 +167,15 @@ EmitLabelDifference(Label, Label->getSection().getBeginSymbol(), 4); } -void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntryRef S) const { +void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntry S) const { if (MAI->doesDwarfUseRelocationsAcrossSections()) { - emitDwarfSymbolReference(S.getSymbol()); + assert(S.Symbol && "No symbol available"); + emitDwarfSymbolReference(S.Symbol); return; } // Just emit the offset directly; no need for symbol math. - EmitInt32(S.getOffset()); + EmitInt32(S.Offset); } //===----------------------------------------------------------------------===//