aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin@accesssoftek.com>2020-06-03 16:51:51 +0700
committerIgor Kudrin <ikudrin@accesssoftek.com>2020-06-16 15:50:13 +0700
commitab7458fb04ae6e12925fd85f2277bb9fa78d61eb (patch)
treee5d5e5571cdea0211baf0e812aee67781ea049cb /llvm/lib/MC/MCDwarf.cpp
parentb5f8959bcd9f5377c988da78c55ef62ee97090df (diff)
downloadllvm-ab7458fb04ae6e12925fd85f2277bb9fa78d61eb.zip
llvm-ab7458fb04ae6e12925fd85f2277bb9fa78d61eb.tar.gz
llvm-ab7458fb04ae6e12925fd85f2277bb9fa78d61eb.tar.bz2
[MC] Generate .debug_rnglists in the 64-bit DWARF format [5/7]
In addition, the patch fixes referencing the section within a compilation unit. Differential Revision: https://reviews.llvm.org/D81147
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index a9820f8..d727de4 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -50,8 +50,14 @@ MCSymbol *mcdwarf::emitListsTableHeaderStart(MCStreamer &S) {
S.getContext().createTempSymbol("debug_list_header_start", true, true);
MCSymbol *End =
S.getContext().createTempSymbol("debug_list_header_end", true, true);
+ auto DwarfFormat = S.getContext().getDwarfFormat();
+ if (DwarfFormat == dwarf::DWARF64) {
+ S.AddComment("DWARF64 mark");
+ S.emitInt32(dwarf::DW_LENGTH_DWARF64);
+ }
S.AddComment("Length");
- S.emitAbsoluteSymbolDiff(End, Start, 4);
+ S.emitAbsoluteSymbolDiff(End, Start,
+ dwarf::getDwarfOffsetByteSize(DwarfFormat));
S.emitLabel(Start);
S.AddComment("Version");
S.emitInt16(S.getContext().getDwarfVersion());
@@ -1014,9 +1020,9 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
if (RangesSymbol) {
// There are multiple sections containing code, so we must use
- // .debug_ranges/.debug_rnglists. AT_ranges, the 4 byte offset from the
+ // .debug_ranges/.debug_rnglists. AT_ranges, the 4/8 byte offset from the
// start of the .debug_ranges/.debug_rnglists.
- MCOS->emitSymbolValue(RangesSymbol, 4);
+ MCOS->emitSymbolValue(RangesSymbol, OffsetSize);
} else {
// If we only have one non-empty code section, we can use the simpler
// AT_low_pc and AT_high_pc attributes.