Whole Program Analysis with dynamically loaded libraries


I was wondering if there is any way we can run whole program analysis on more than just one compilation unit. I would like to include the dynamically loaded libraries into the call graph too.

Is there a way to do that?

Thanks and Regards


Yes, you can do whole program analysis with LLVM. You can either a) link the bitcode files of each compilation unit together with llvm-link and then use opt to run your pass(es) on the whole-program bitcode file; or b) Modify the LLVM Gold plugin to run your pass. The former is easier to do; the latter will make it easier to use your pass(es) on large open-source projects. For dynamically loaded libraries, you will need to compile their source code to LLVM bitcode and link their bitcode files statically into the program. Alternatively (though this is unlikely to work), you could use a tool like RevGen to translate their the library native code into LLVM IR. Regards, John Criswell