@@ -54,12 +54,16 @@ open BCHDoubleword
5454open BCHFloc
5555open BCHLocation
5656open BCHFtsParameter
57+ open BCHFunctionData
5758open BCHFunctionInterface
5859open BCHFunctionSummaryLibrary
5960open BCHLibTypes
6061open BCHLocation
6162open BCHSystemInfo
6263
64+ (* bchlibelf *)
65+ open BCHELFHeader
66+
6367(* bchlibarm32 *)
6468open BCHARMAssemblyInstructions
6569open BCHARMConditionalExpr
@@ -419,8 +423,32 @@ object (self)
419423 " function prototype registration"
420424 (LBLOCK [STR " No function summary found for " ; STR name]) in
421425
426+ let check_for_functionptr_args callargs =
427+ List. iter (fun (p , x ) ->
428+ let ptype = get_parameter_type p in
429+ if is_function_type ptype then
430+ match x with
431+ | XConst (IntConst n ) ->
432+ (match numerical_to_doubleword n with
433+ | Error _ -> ()
434+ | Ok dw ->
435+ if elf_header#is_code_address dw then
436+ begin
437+ ignore (functions_data#add_function dw);
438+ chlog#add
439+ " add function entry point"
440+ (LBLOCK [
441+ floc#l#toPretty;
442+ STR " : function addr: " ;
443+ dw#toPretty])
444+ end )
445+ | _ -> ()
446+ else
447+ () ) callargs in
448+
422449 let callinstr_key () : (string list * int list) =
423450 let callargs = floc#get_call_arguments in
451+ let _ = check_for_functionptr_args callargs in
424452 let (xprs, xvars, rdefs) =
425453 List. fold_left (fun (xprs , xvars , rdefs ) (p , x ) ->
426454 let xvar =
@@ -746,8 +774,8 @@ object (self)
746774 let (tags, args) = add_optional_instr_condition tagstring args c in
747775 (tags, args)
748776
749- | Branch (_, tgt, _)
750- when tgt#is_absolute_address && floc#has_call_target ->
777+ | Branch _
778+ | BranchExchange _ when floc#has_call_target ->
751779 callinstr_key ()
752780
753781 | Branch _ when instr#is_aggregate_anchor ->
0 commit comments