[LLVMdev] Getting LLVM bit-code for programs using a couple of libraries

Sandeep K Chaudhary babbusandy2006 at gmail.com
Thu May 29 11:05:49 PDT 2014


Hi Tim,

Thanks a lot for the replies, and the clarification !

I can now try these things.

Thanks and regards,
Sandeep.


On Wed, May 28, 2014 at 2:07 AM, Tim Northover <t.p.northover at gmail.com>wrote:

> Hi Sandeep,
>
> > Does it mean that I need to give -flto option for compilation while
> > building the libraries that I am using i.e. lttng-ust and libdl?
>
> No, you can mix and match lto and non-lto files & libraries.
>
> >> If you just want the LLVM IR for a reasonably large project, you
> >> should probably setup a parallel set of "build" steps that produce the
> >> IR but aren't involved in the actual compilation.
> >
> > So, does it mean adding -flto option in each build step? Can you
> > please explain this a bit? I mean - how to set up such a parallel set
> > of builds in my case?
>
> You need a compatible linker (which means ld.gold or a recent ld.bfd,
> I don't know the version off the top of my head). You then need to add
> "-flto" to both compile and link steps. With luck, that will just
> work. For example, with a trivial single file:
>
> $ clang -c -O3 -flto hello.c
> $ clang -flto hello.o -ohello
>
> But I realise I didn't say what -flto was: it's link-time
> optimization. Generally the code you get out is better, but it incurs
> significant memory and build time overheads. It may not be practical,
> depending on the size of your project.
>
> Cheers.
>
> Tim.
>



-- 
Thanks and regards,
Sandeep K Chaudhary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140529/c0e39cbd/attachment.html>


More information about the llvm-dev mailing list