[LLVMdev] indirect calls tracking and control flow graph

Amara Emerson amara.emerson at gmail.com
Mon Apr 28 09:59:52 PDT 2014


Hi Thanasis,

You should be able to do this easily by writing a FunctionPass (see
http://llvm.org/docs/WritingAnLLVMPass.html for more info) and
iterating over the instructions in the function, searching for
CallInst instructions and using getCalledFunction() to check if it's
indirect.

Amara

On 28 April 2014 14:10, Petsas Athanasios <petsas at ics.forth.gr> wrote:
> Dear all,
>
> I would like to keep track of all the indirect calls that may caused from
> function
> pointers inside a program. I need this in order to be able to construct the
> control
> flow graph of all the indirect calls, that is which function is legal to
> call another
> function.
>
> Is there a module that implements this functionality in llvm? If not, is
> there a way to
> do it? Maybe through implementing a pass. I am new to llvm. Could you
> suggest me
> a way to start doing this? Perhaps the llvm intermediate code can help me on
> this.
> Do you know where this code is being produced? or what files or passes do I
> have
> to modify for this?
>
> Until now I have used this command to produce and study the llvm bitcode for
> a test
> program:
> clang -S -emit-llvm fpointers.c -c -o fpointers.bc.text
>
> Thank you,
>
> --
> Thanasis Petsas
> Distributed Computing Systems (DCS)
> Institute of Computer Science (ICS/FORTH)
> Heraklion, Crete
> Greece (GR)
>
> http://www.thanasispetsas.com/
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list