[PATCH] D132087: [DWARF][BOLT] Fix handling of converting range accesss from ofset to index.
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 15:28:55 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG928c2ba17966: [DWARF][BOLT] Fix handling of converting range accesss from ofset to index. (authored by ayermolo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132087/new/
https://reviews.llvm.org/D132087
Files:
bolt/lib/Rewrite/DWARFRewriter.cpp
bolt/test/X86/dwarf5-rangeoffset-to-rangeindex.s
Index: bolt/test/X86/dwarf5-rangeoffset-to-rangeindex.s
===================================================================
--- bolt/test/X86/dwarf5-rangeoffset-to-rangeindex.s
+++ bolt/test/X86/dwarf5-rangeoffset-to-rangeindex.s
@@ -21,6 +21,11 @@
# POSTCHECK-SAME: (indexed (0x0) rangelist = 0x00000018
# POSTCHECK-NEXT: [0x[[#ADDR]], 0x[[#ADDR + 11]]
# POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 11]]
+# POSTCHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]
+# POSTCHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset]
+# POSTCHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)
+# POSTCHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
+
# int foo() {
# return 3;
Index: bolt/lib/Rewrite/DWARFRewriter.cpp
===================================================================
--- bolt/lib/Rewrite/DWARFRewriter.cpp
+++ bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -858,18 +858,20 @@
return;
}
- // Convert DW_AT_low_pc into DW_AT_GNU_ranges_base.
- if (!LowPCAttrInfo) {
- errs() << "BOLT-ERROR: skeleton CU at 0x"
- << Twine::utohexstr(DIE.getOffset())
- << " does not have DW_AT_GNU_ranges_base or DW_AT_low_pc to"
- " convert to update ranges base\n";
+ if (DIE.getOffset() != DIE.getDwarfUnit()->getUnitDIE().getOffset())
return;
- }
- AbbrevWriter.addAttribute(*DIE.getDwarfUnit(), AbbreviationDecl,
- dwarf::DW_AT_GNU_ranges_base,
- dwarf::DW_FORM_sec_offset);
+ // If we are at this point we are in the CU/Skeleton CU, and
+ // DW_AT_GNU_ranges_base or DW_AT_rnglists_base doesn't exist.
+ if (DIE.getDwarfUnit()->getVersion() >= 5) {
+ AbbrevWriter.addAttribute(*DIE.getDwarfUnit(), AbbreviationDecl,
+ dwarf::DW_AT_rnglists_base,
+ dwarf::DW_FORM_sec_offset);
+ } else {
+ AbbrevWriter.addAttribute(*DIE.getDwarfUnit(), AbbreviationDecl,
+ dwarf::DW_AT_GNU_ranges_base,
+ dwarf::DW_FORM_sec_offset);
+ }
reinterpret_cast<DebugInfoBinaryPatcher &>(DebugInfoPatcher)
.insertNewEntry(DIE, *RangesBase);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132087.454123.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220819/cfcb08b2/attachment.bin>
More information about the llvm-commits
mailing list