diff options
author | Victor Leschuk <vleschuk@accesssoftek.com> | 2018-08-01 05:48:06 +0000 |
---|---|---|
committer | Victor Leschuk <vleschuk@accesssoftek.com> | 2018-08-01 05:48:06 +0000 |
commit | 64e0c56717628333554be781d70d5fe45d5b9b0b (patch) | |
tree | d78c97652ac8f1ab049ea84160ca7fa763a219a1 /llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp | |
parent | 63ebd3bd24d414737e5404923dcd1b8dbdb8ee46 (diff) | |
download | bcm5719-llvm-64e0c56717628333554be781d70d5fe45d5b9b0b.tar.gz bcm5719-llvm-64e0c56717628333554be781d70d5fe45d5b9b0b.zip |
[DWARF] Basic support for producing DWARFv5 .debug_addr section
This revision implements support for generating DWARFv5 .debug_addr section.
The implementation is pretty straight-forward: we just check the dwarf version
and emit section header if needed.
Reviewers: aprantl, dblaikie, probinson
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D50005
llvm-svn: 338487
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp index 4a226527cb5..c8305ad9c54 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp @@ -24,8 +24,26 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) { return IterBool.first->second.Number; } + +void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) { + static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize(); + Asm.OutStreamer->SwitchSection(Section); + + uint64_t Length = sizeof(uint16_t) // version + + sizeof(uint8_t) // address_size + + sizeof(uint8_t) // segment_selector_size + + AddrSize * Pool.size(); // entries + Asm.emitInt32(Length); // TODO: Support DWARF64 format. + Asm.emitInt16(Asm.getDwarfVersion()); + Asm.emitInt8(AddrSize); + Asm.emitInt8(0); // TODO: Support non-zero segment_selector_size. +} + // Emit addresses into the section given. void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) { + if (Asm.getDwarfVersion() >= 5) + emitHeader(Asm, AddrSection); + if (Pool.empty()) return; |