Added support for generate DWARF .debug_aranges sections automatically.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191052 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Mitton
2013-09-19 23:21:01 +00:00
parent 70e0b047be
commit 5cc319a42a
18 changed files with 453 additions and 26 deletions

View File

@@ -85,6 +85,8 @@ public:
virtual void EmitValueToAlignment(unsigned, int64_t, unsigned, unsigned);
virtual void Flush();
virtual void FinishImpl();
/// @}

View File

@@ -86,6 +86,10 @@ private:
MCSymbol *LastSymbol;
// SymbolOrdering - Tracks an index to represent the order
// a symbol was emitted in. Zero means we did not emit that symbol.
DenseMap<const MCSymbol *, unsigned> SymbolOrdering;
/// SectionStack - This is stack of current and previous section
/// values saved by PushSection.
SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
@@ -185,6 +189,12 @@ public:
return MCSectionSubPair();
}
/// GetSymbolOrder - Returns an index to represent the order
/// a symbol was emitted in. (zero if we did not emit that symbol)
unsigned GetSymbolOrder(const MCSymbol *Sym) const {
return SymbolOrdering.lookup(Sym);
}
/// ChangeSection - Update streamer for a new active section.
///
/// This is called by PopSection and SwitchSection, if the current
@@ -264,6 +274,12 @@ public:
/// InitToTextSection - Create a text section and switch the streamer to it.
virtual void InitToTextSection() = 0;
/// AssignSection - Sets the symbol's section.
///
/// Each emitted symbol will be tracked in the ordering table,
/// so we can sort on them later.
void AssignSection(MCSymbol *Symbol, const MCSection *Section);
/// EmitLabel - Emit a label for @p Symbol into the current section.
///
/// This corresponds to an assembler statement such as:
@@ -620,6 +636,9 @@ public:
/// these methods there.
virtual void EmitTCEntry(const MCSymbol &S);
/// Flush - Causes any cached state to be written out.
virtual void Flush() {}
/// FinishImpl - Streamer specific finalization.
virtual void FinishImpl() = 0;
/// Finish - Finish emission of machine code.