@@ -86,7 +86,7 @@ bool Workflow::rewriteMethodCall(LLILFunctionRef ssa, size_t insnIndex)
86
86
const auto bv = function->GetView ();
87
87
const auto llil = ssa->GetNonSSAForm ();
88
88
const auto insn = ssa->GetInstruction (insnIndex);
89
- const auto params = insn.GetParameterExprs <LLIL_CALL_SSA> ();
89
+ const auto params = insn.GetParameterExprs ();
90
90
91
91
// The second parameter passed to the objc_msgSend call is the address of
92
92
// either the selector reference or the method's name, which in both cases
@@ -254,12 +254,13 @@ void Workflow::inlineMethodCalls(AnalysisContextRef ac)
254
254
const auto rewriteIfEligible = [bv, messageHandler, ssa](size_t insnIndex) {
255
255
auto insn = ssa->GetInstruction (insnIndex);
256
256
257
- if (insn.operation == LLIL_CALL_SSA)
257
+ if (insn.operation == LLIL_CALL_SSA || insn. operation == LLIL_TAILCALL_SSA )
258
258
{
259
259
// Filter out calls that aren't to `objc_msgSend`.
260
- auto callExpr = insn.GetDestExpr <LLIL_CALL_SSA>();
261
- bool isMessageSend = messageHandler->isMessageSend (callExpr.GetValue ().value );
262
- if (auto symbol = bv->GetSymbolByAddress (callExpr.GetValue ().value ))
260
+ auto callExpr = insn.GetDestExpr ();
261
+ auto callTarget = callExpr.GetValue ().value ;
262
+ bool isMessageSend = messageHandler->isMessageSend (callTarget);
263
+ if (auto symbol = bv->GetSymbolByAddress (callTarget))
263
264
isMessageSend = isMessageSend || symbol->GetRawName () == " _objc_msgSend" ;
264
265
if (!isMessageSend)
265
266
return false ;
@@ -294,7 +295,7 @@ void Workflow::registerActivities()
294
295
const auto wf = BinaryNinja::Workflow::Instance (" core.function.baseAnalysis" )->Clone (" core.function.objectiveC" );
295
296
wf->RegisterActivity (new BinaryNinja::Activity (
296
297
ActivityID::ResolveMethodCalls, &Workflow::inlineMethodCalls));
297
- wf->Insert (" core.function.translateTailCalls" , ActivityID::ResolveMethodCalls);
298
+ wf->InsertAfter (" core.function.translateTailCalls" , ActivityID::ResolveMethodCalls);
298
299
299
300
BinaryNinja::Workflow::RegisterWorkflow (wf, WorkflowInfo);
300
301
}
0 commit comments