Hi all, I'm trying to generate whole program bitcode files for linux kernel and do interprocedural analysis on kernel. I use llvmlinux to compile kernel with clang and generate a bunch of bitcode files successfully. I need to link all these bitcode files together into a single bitcode file, so that I can run whole program analysis. Can I use llvm-link to achieve this? Or should I use libLTO to link all these bitcode files together? I guess I have to modify the linux kernel's build scripts and Makefiles? I'm kind of confused. Any suggestions? Thank you Regards, Kai -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160105/b657cebf/attachment.html>
Mehdi Amini via llvm-dev
2016-Jan-06 16:53 UTC
[llvm-dev] Whole program LLVM bitcode files
Hi,> On Jan 5, 2016, at 3:22 PM, Kai Wang via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > Hi all, > > I'm trying to generate whole program bitcode files for linux kernel and do interprocedural analysis on kernel. > > I use llvmlinux to compile kernel with clang and generate a bunch of bitcode files successfully. > I need to link all these bitcode files together into a single bitcode file, so that I can run whole program analysis. > > Can I use llvm-link to achieve this?Yes.> Or should I use libLTO to link all these bitcode files together? I guess I have to modify the linux kernel's build scripts and Makefiles?libLTO is used directly by *some* linkers to perform both linking the modules and optimizing the result. Depending on what you’re trying to achieve, it can be interesting for you. In any case you can start with llvm-link to get your analysis working with opt, and it won’t be hard to integrate it in LTO later if needed. — Mehdi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160106/453ee8f1/attachment.html>
Duncan P. N. Exon Smith via llvm-dev
2016-Jan-06 19:43 UTC
[llvm-dev] Whole program LLVM bitcode files
> On 2016-Jan-06, at 08:53, Mehdi Amini via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > >> On Jan 5, 2016, at 3:22 PM, Kai Wang via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> >> Hi all, >> >> I'm trying to generate whole program bitcode files for linux kernel and do interprocedural analysis on kernel. >> >> I use llvmlinux to compile kernel with clang and generate a bunch of bitcode files successfully. >> I need to link all these bitcode files together into a single bitcode file, so that I can run whole program analysis. >> >> Can I use llvm-link to achieve this? > > Yes.Just a note: llvm-link is a tool for LLVM developers (i.e., compiler hackers), mainly for use in regression tests. I don't recommend using it in a production workflow. It will certainly work for hacking around though!