Skip to content

Commit e1ceae4

Browse files
committed
[BOLT][DWARF] Fix setting DW_AT_ranges offset of Skeleton CU
Fixed a bug where when Skelton CU had DW_AT_ranges, it the output CU DW_AT_ranges offset was relative, and not absolute. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D156958
1 parent efb8a1c commit e1ceae4

File tree

5 files changed

+1566
-2
lines changed

5 files changed

+1566
-2
lines changed

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,12 @@ void DWARFRewriter::updateDWARFObjectAddressRanges(
12441244
NeedConverted = true;
12451245

12461246
uint64_t CurRangeBase = 0;
1247-
if (std::optional<uint64_t> DWOId = Unit.getDWOId()) {
1248-
CurRangeBase = getDwoRangesBase(*DWOId);
1247+
if (Unit.isDWOUnit()) {
1248+
if (std::optional<uint64_t> DWOId = Unit.getDWOId())
1249+
CurRangeBase = getDwoRangesBase(*DWOId);
1250+
else
1251+
errs() << "BOLT-WARNING: [internal-dwarf-error]: DWOId is not found "
1252+
"for DWO Unit.";
12491253
}
12501254
if (NeedConverted || RangesAttrInfo.getForm() == dwarf::DW_FORM_rnglistx)
12511255
DIEBldr.replaceValue(&Die, dwarf::DW_AT_ranges, dwarf::DW_FORM_rnglistx,

0 commit comments

Comments
 (0)