[llvm] [BOLT] Gadget scanner: clarify MCPlusBuilder callbacks interface (PR #136147)
Anatoly Trosinenko via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 09:52:07 PDT 2025
================
@@ -787,19 +794,20 @@ shouldReportSigningOracle(const BinaryContext &BC, const MCInstReference &Inst,
const SrcState &S) {
static const GadgetKind SigningOracleKind("signing oracle found");
- MCPhysReg SignedReg = BC.MIB->getSignedReg(Inst);
- if (SignedReg == BC.MIB->getNoRegister())
+ std::optional<MCPhysReg> SignedReg = BC.MIB->getSignedReg(Inst);
+ if (!SignedReg)
return std::nullopt;
+ assert(*SignedReg != BC.MIB->getNoRegister());
----------------
atrosinenko wrote:
Replacing `if (mayLoad(Inst)) {...}` with `if (Desc.mayLoad()) {...}` in the single-instruction overload of `getAuthCheckedReg` callback does not work: while `AArch64MCPlusBuilder::mayLoad(Inst)` returns true only for load instructions (but not all instructions are handled), the `MCInstrDesc::mayLoad()` method, in accordance with its name, returns true if the instruction *may* read anything from memory (such as for `AArch64::HINT`).
Added a FIXME in c73d6fdd679886c2177b06e1b4b806e90f59e7e4.
https://github.com/llvm/llvm-project/pull/136147
More information about the llvm-commits
mailing list