[PATCH] D81147: [MC] Generate .debug_rnglists in the 64-bit DWARF format [5/7]
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 16 02:10:19 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGab7458fb04ae: [MC] Generate .debug_rnglists in the 64-bit DWARF format [5/7] (authored by ikudrin).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81147/new/
https://reviews.llvm.org/D81147
Files:
llvm/lib/MC/MCDwarf.cpp
llvm/test/MC/ELF/gen-dwarf64.s
Index: llvm/test/MC/ELF/gen-dwarf64.s
===================================================================
--- llvm/test/MC/ELF/gen-dwarf64.s
+++ llvm/test/MC/ELF/gen-dwarf64.s
@@ -8,6 +8,7 @@
# REL: Section ({{[0-9]+}}) .rela.debug_info {
# REL-NEXT: R_X86_64_64 .debug_abbrev 0x0
# REL-NEXT: R_X86_64_64 .debug_line 0x0
+# REL5-NEXT: R_X86_64_64 .debug_rnglists 0x14
# REL: Section ({{[0-9]+}}) .rela.debug_aranges {
# REL-NEXT: R_X86_64_64 .debug_info 0x0
# REL5: Section ({{[0-9]+}}) .rela.debug_line {
@@ -18,11 +19,17 @@
# DUMP-NEXT: 0x00000000: Compile Unit: {{.*}} format = DWARF64
# DUMP: DW_TAG_compile_unit [1] *
# DUMP5-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000000000000000)
+# DUMP5-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000000000000014
+# DUMP-NEXT: [0x0000000000000000, 0x0000000000000001) ".foo"
+# DUMP-NEXT: [0x0000000000000000, 0x0000000000000001) ".bar")
# DUMP: DW_TAG_label [2]
# DUMP-NEXT: DW_AT_name [DW_FORM_string] ("foo")
+# DUMP: DW_TAG_label [2]
+# DUMP-NEXT: DW_AT_name [DW_FORM_string] ("bar")
# DUMP: .debug_aranges contents:
-# DUMP-NEXT: Address Range Header: length = 0x0000000000000034, format = DWARF64, version = 0x0002, cu_offset = 0x0000000000000000, addr_size = 0x08, seg_size = 0x00
+# DUMP-NEXT: Address Range Header: length = 0x0000000000000044, format = DWARF64, version = 0x0002, cu_offset = 0x0000000000000000, addr_size = 0x08, seg_size = 0x00
+# DUMP-NEXT: [0x0000000000000000, 0x0000000000000001)
# DUMP-NEXT: [0x0000000000000000, 0x0000000000000001)
# DUMP-EMPTY:
@@ -40,6 +47,17 @@
# DUMP5-NEXT: 0x00000000: "[[DIR]]"
# DUMP5-NEXT: 0x[[FILEOFF]]: "[[FILE]]"
+# DUMP5: .debug_rnglists contents:
+# DUMP5-NEXT: 0x00000000: range list header: length = 0x000000000000001d, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
+# DUMP5-NEXT: ranges:
+# DUMP5-NEXT: 0x00000014: [DW_RLE_start_length]: 0x0000000000000000, 0x0000000000000001 => [0x0000000000000000, 0x0000000000000001)
+# DUMP5-NEXT: 0x0000001e: [DW_RLE_start_length]: 0x0000000000000000, 0x0000000000000001 => [0x0000000000000000, 0x0000000000000001)
+# DUMP5-NEXT: 0x00000028: [DW_RLE_end_of_list ]
+
.section .foo, "ax", @progbits
foo:
nop
+
+ .section .bar, "ax", @progbits
+bar:
+ nop
Index: llvm/lib/MC/MCDwarf.cpp
===================================================================
--- llvm/lib/MC/MCDwarf.cpp
+++ llvm/lib/MC/MCDwarf.cpp
@@ -50,8 +50,14 @@
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 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81147.270991.patch
Type: text/x-patch
Size: 3769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200616/00581a67/attachment.bin>
More information about the llvm-commits
mailing list