@@ -551,25 +551,6 @@ void DIEBuilder::finish() {
551
551
updateReferences ();
552
552
}
553
553
554
- DWARFDie DIEBuilder::resolveDIEReference (
555
- const DWARFFormValue &RefValue,
556
- const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
557
- DWARFUnit *&RefCU, DWARFDebugInfoEntry &DwarfDebugInfoEntry) {
558
- assert (RefValue.isFormClass (DWARFFormValue::FC_Reference));
559
- uint64_t RefOffset;
560
- if (std::optional<uint64_t > Off = RefValue.getAsRelativeReference ()) {
561
- RefOffset = RefValue.getUnit ()->getOffset () + *Off;
562
- } else if (Off = RefValue.getAsDebugInfoReference (); Off) {
563
- RefOffset = *Off;
564
- } else {
565
- BC.errs ()
566
- << " BOLT-WARNING: [internal-dwarf-error]: unsupported reference type: "
567
- << FormEncodingString (RefValue.getForm ()) << " .\n " ;
568
- return DWARFDie ();
569
- }
570
- return resolveDIEReference (AttrSpec, RefOffset, RefCU, DwarfDebugInfoEntry);
571
- }
572
-
573
554
DWARFDie DIEBuilder::resolveDIEReference (
574
555
const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
575
556
const uint64_t RefOffset, DWARFUnit *&RefCU,
@@ -613,23 +594,14 @@ DWARFDie DIEBuilder::resolveDIEReference(
613
594
return DWARFDie ();
614
595
}
615
596
616
- void DIEBuilder::cloneDieReferenceAttribute (
597
+ void DIEBuilder::cloneDieOffsetReferenceAttribute (
617
598
DIE &Die, const DWARFUnit &U, const DWARFDie &InputDIE,
618
- const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
619
- const DWARFFormValue &Val) {
620
- uint64_t Ref;
621
- if (std::optional<uint64_t > Off = Val.getAsRelativeReference ())
622
- Ref = Val.getUnit ()->getOffset () + *Off;
623
- else if (Off = Val.getAsDebugInfoReference (); Off)
624
- Ref = *Off;
625
- else
626
- return ;
627
-
599
+ const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec, uint64_t Ref) {
628
600
DIE *NewRefDie = nullptr ;
629
601
DWARFUnit *RefUnit = nullptr ;
630
602
631
603
DWARFDebugInfoEntry DDIEntry;
632
- const DWARFDie RefDie = resolveDIEReference (Val, AttrSpec , RefUnit, DDIEntry);
604
+ const DWARFDie RefDie = resolveDIEReference (AttrSpec, Ref , RefUnit, DDIEntry);
633
605
634
606
if (!RefDie)
635
607
return ;
@@ -834,7 +806,7 @@ void DIEBuilder::cloneAddressAttribute(
834
806
void DIEBuilder::cloneRefsigAttribute (
835
807
DIE &Die, DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
836
808
const DWARFFormValue &Val) {
837
- const std::optional<uint64_t > SigVal = Val.getRawUValue ();
809
+ const std::optional<uint64_t > SigVal = Val.getAsSignatureReference ();
838
810
Die.addValue (getState ().DIEAlloc , AttrSpec.Attr , dwarf::DW_FORM_ref_sig8,
839
811
DIEInteger (*SigVal));
840
812
}
@@ -902,11 +874,16 @@ void DIEBuilder::cloneAttribute(
902
874
cloneStringAttribute (Die, U, AttrSpec, Val);
903
875
break ;
904
876
case dwarf::DW_FORM_ref_addr:
877
+ cloneDieOffsetReferenceAttribute (Die, U, InputDIE, AttrSpec,
878
+ *Val.getAsDebugInfoReference ());
879
+ break ;
905
880
case dwarf::DW_FORM_ref1:
906
881
case dwarf::DW_FORM_ref2:
907
882
case dwarf::DW_FORM_ref4:
908
883
case dwarf::DW_FORM_ref8:
909
- cloneDieReferenceAttribute (Die, U, InputDIE, AttrSpec, Val);
884
+ cloneDieOffsetReferenceAttribute (Die, U, InputDIE, AttrSpec,
885
+ Val.getUnit ()->getOffset () +
886
+ *Val.getAsRelativeReference ());
910
887
break ;
911
888
case dwarf::DW_FORM_block:
912
889
case dwarf::DW_FORM_block1:
0 commit comments