Store an optional section start label in MCSection.

This makes code that uses section relative expressions (debug info) simpler and
less brittle.

This is still a bit awkward as the symbol is created late and has to be
stored in a mutable field.

I will move the symbol creation earlier in the next patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-03-10 16:58:10 +00:00
parent f681b3f13f
commit 0f4df6dc6f
14 changed files with 105 additions and 143 deletions

View File

@@ -120,7 +120,6 @@ protected:
DwarfUnit(unsigned UID, dwarf::Tag, DICompileUnit CU, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
void initSection(const MCSection *Section);
/// Add a string attribute data and value.
void addLocalString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);
@@ -132,6 +131,8 @@ protected:
public:
virtual ~DwarfUnit();
void initSection(const MCSection *Section);
const MCSection *getSection() const {
assert(Section);
return Section;
@@ -321,7 +322,7 @@ public:
}
/// Emit the header for this unit, not including the initial length field.
virtual void emitHeader(const MCSymbol *ASectionSym);
virtual void emitHeader(bool UseOffsets);
virtual DwarfCompileUnit &getCU() = 0;
@@ -423,12 +424,11 @@ public:
void setType(const DIE *Ty) { this->Ty = Ty; }
/// Emit the header for this unit, not including the initial length field.
void emitHeader(const MCSymbol *ASectionSym) override;
void emitHeader(bool UseOffsets) override;
unsigned getHeaderSize() const override {
return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
sizeof(uint32_t); // Type DIE Offset
}
using DwarfUnit::initSection;
DwarfCompileUnit &getCU() override { return CU; }
};
} // end llvm namespace