@@ -1680,7 +1680,7 @@ static void printBB(const BinaryContext &BC, const BinaryBasicBlock *BB,
16801680 MCInstReference Inst (BB, I);
16811681 if (BC.MIB ->isCFI (Inst))
16821682 continue ;
1683- BC.printInstruction (outs (), Inst, Inst.getAddress (), BF);
1683+ BC.printInstruction (outs (), Inst, Inst.computeAddress (), BF);
16841684 }
16851685}
16861686
@@ -1700,14 +1700,15 @@ void Diagnostic::printBasicInfo(raw_ostream &OS, const BinaryContext &BC,
17001700 StringRef IssueKind) const {
17011701 const BinaryBasicBlock *BB = Location.getBasicBlock ();
17021702 const BinaryFunction *BF = Location.getFunction ();
1703+ const uint64_t Address = Location.computeAddress ();
17031704
17041705 OS << " \n GS-PAUTH: " << IssueKind;
17051706 OS << " in function " << BF->getPrintName ();
17061707 if (BB)
17071708 OS << " , basic block " << BB->getName ();
1708- OS << " , at address " << llvm::format (" %x" , Location. getAddress () ) << " \n " ;
1709+ OS << " , at address " << llvm::format (" %x" , Address ) << " \n " ;
17091710 OS << " The instruction is " ;
1710- BC.printInstruction (OS, Location, Location. getAddress () , BF);
1711+ BC.printInstruction (OS, Location, Address , BF);
17111712}
17121713
17131714void GadgetDiagnostic::generateReport (raw_ostream &OS,
@@ -1721,15 +1722,17 @@ static void printRelatedInstrs(raw_ostream &OS, const MCInstReference Location,
17211722 const BinaryContext &BC = BF.getBinaryContext ();
17221723
17231724 // Sort by address to ensure output is deterministic.
1724- SmallVector<MCInstReference> RI (RelatedInstrs);
1725- llvm::sort (RI, [](const MCInstReference &A, const MCInstReference &B) {
1726- return A.getAddress () < B.getAddress ();
1727- });
1725+ SmallVector<std::pair<uint64_t , MCInstReference>> RI;
1726+ for (auto &InstRef : RelatedInstrs)
1727+ RI.push_back (std::make_pair (InstRef.computeAddress (), InstRef));
1728+ llvm::sort (RI, [](auto A, auto B) { return A.first < B.first ; });
1729+
17281730 for (unsigned I = 0 ; I < RI.size (); ++I) {
1729- MCInstReference InstRef = RI[I];
1731+ auto [Address, InstRef] = RI[I];
17301732 OS << " " << (I + 1 ) << " . " ;
1731- BC.printInstruction (OS, InstRef, InstRef.getAddress (), &BF);
1733+ BC.printInstruction (OS, InstRef, InstRef.computeAddress (), &BF);
17321734 };
1735+
17331736 if (RelatedInstrs.size () == 1 ) {
17341737 const MCInstReference RelatedInst = RelatedInstrs[0 ];
17351738 // Printing the details for the MCInstReference::FunctionParent case
0 commit comments