Skip to content

Commit

Permalink
Fix bolt for llvm#98905
Browse files Browse the repository at this point in the history
  • Loading branch information
labath committed Jul 16, 2024
1 parent 4abdb85 commit 9dab912
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bolt/lib/Core/DIEBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,17 @@ DWARFDie DIEBuilder::resolveDIEReference(
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
DWARFUnit *&RefCU, DWARFDebugInfoEntry &DwarfDebugInfoEntry) {
assert(RefValue.isFormClass(DWARFFormValue::FC_Reference));
uint64_t RefOffset = *RefValue.getAsReference();
uint64_t RefOffset;
if (std::optional<uint64_t> Off = RefValue.getAsRelativeReference()) {
RefOffset = RefValue.getUnit()->getOffset() + *Off;
} else if (Off = RefValue.getAsDebugInfoReference(); Off) {
RefOffset = *Off;
} else {
BC.errs()
<< "BOLT-WARNING: [internal-dwarf-error]: unsupported reference type: "
<< FormEncodingString(RefValue.getForm()) << ".\n";
return DWARFDie();
}
return resolveDIEReference(AttrSpec, RefOffset, RefCU, DwarfDebugInfoEntry);
}

Expand Down Expand Up @@ -607,7 +617,13 @@ void DIEBuilder::cloneDieReferenceAttribute(
DIE &Die, const DWARFUnit &U, const DWARFDie &InputDIE,
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
const DWARFFormValue &Val) {
const uint64_t Ref = *Val.getAsReference();
uint64_t Ref;
if (std::optional<uint64_t> Off = Val.getAsRelativeReference())
Ref = Val.getUnit()->getOffset() + *Off;
else if (Off = Val.getAsDebugInfoReference(); Off)
Ref = *Off;
else
return;

DIE *NewRefDie = nullptr;
DWARFUnit *RefUnit = nullptr;
Expand Down

0 comments on commit 9dab912

Please sign in to comment.