[llvm-dev] Functions accessible from a function

Shen Liu via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 20 23:38:05 PDT 2017


A simple solution is to analyze the argument list of function no_source, if
an argument is a function pointer(assume the function type is fTy), draw
control dependence edges from this working callInst to all the candidate
callee functions with the same function type fTy, some approximations are
required here, since you are doing type-based analysis, this approximation
is unavoidable.

On Tue, Mar 21, 2017 at 2:21 AM, Alex Denisov via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello everybody,
>
> I am trying to do some static analysis, e.g. find which other functions
> accessible from a function.
> Current naive implementation goes over each instruction and whether it is
> a call site or not.
> It works great so far, but there are some cases where it doesn’t work. For
> example:
>
>   declare no_source(function: f) // uses f internally
>   define foo() { ... }
>   define bar() { ... }
>
>   define buzz() {
>     call foo()
>     call no_source(&bar)
>     ret
>   }
>
> In this case, my implementation catches 'foo' but not 'bar.'
> There are must be less trivial but also detectable cases.
>
> Can anybody give a hint or advice on how to do such kind of analysis?
>
> Cheers,
> Alex.
> --
> AlexDenisov
> Software Engineer, https://lowlevelbits.org
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170321/c13322b5/attachment.html>


More information about the llvm-dev mailing list