diff options
author | Richard Mitton <richard@codersnotes.com> | 2013-09-19 23:21:01 +0000 |
---|---|---|
committer | Richard Mitton <richard@codersnotes.com> | 2013-09-19 23:21:01 +0000 |
commit | 5cc319a42a914b24b164a94d9a563c728a7a4026 (patch) | |
tree | 2101b566f8fb8e3eea815cf1e29fc86c632a322a /lib/MC/MCStreamer.cpp | |
parent | 70e0b047be83cbaca06c0cc72e508667bcd5e95f (diff) | |
download | llvm-5cc319a42a914b24b164a94d9a563c728a7a4026.tar.gz llvm-5cc319a42a914b24b164a94d9a563c728a7a4026.tar.bz2 llvm-5cc319a42a914b24b164a94d9a563c728a7a4026.tar.xz |
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
Diffstat (limited to 'lib/MC/MCStreamer.cpp')
-rw-r--r-- | lib/MC/MCStreamer.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index c2a20f9ca6..4ffde67476 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -191,17 +191,28 @@ void MCStreamer::EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) { } +void MCStreamer::AssignSection(MCSymbol *Symbol, const MCSection *Section) { + if (Section) + Symbol->setSection(*Section); + else + Symbol->setUndefined(); + + // As we emit symbols into a section, track the order so that they can + // be sorted upon later. Zero is reserved to mean 'unemitted'. + SymbolOrdering[Symbol] = 1 + SymbolOrdering.size(); +} + void MCStreamer::EmitLabel(MCSymbol *Symbol) { assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); assert(getCurrentSection().first && "Cannot emit before setting section!"); - Symbol->setSection(*getCurrentSection().first); + AssignSection(Symbol, getCurrentSection().first); LastSymbol = Symbol; } void MCStreamer::EmitDebugLabel(MCSymbol *Symbol) { assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); assert(getCurrentSection().first && "Cannot emit before setting section!"); - Symbol->setSection(*getCurrentSection().first); + AssignSection(Symbol, getCurrentSection().first); LastSymbol = Symbol; } |