[LLVMdev] how to compile a large project to LLVM IR?

Pete Cooper peter_cooper at apple.com
Wed Jun 24 10:54:38 PDT 2015


> On Jun 24, 2015, at 10:19 AM, Eli Bendersky <eliben at google.com> wrote:
> 
> 
> 
> On Wed, Jun 24, 2015 at 7:05 AM, Q Z <zhaoqian301 at gmail.com <mailto:zhaoqian301 at gmail.com>> wrote:
> Hello,I want to compile a large project(for example,Apache httpd) to one .bc file. How can I do this? Can you give me some examples?
> 
> 
> In general, if the codebase of a certain project is compilable by Clang/LLVM, this should be possible, but the devil is in the details (for example - how is the standard library going to get compiled into that .bc file?)
If you only care about the project itself and not things like the standard library, then LTO is possible too.  Depends on the linker you are using, but Apple’s ld and I believe the gold linker both have -save-temps options which save the bit codes before/after optimization but certainly after linking.

Cheers,
Pete
> 
> I suggest you take a look at the "NaCl ports" project (https://code.google.com/p/naclports/ <https://urldefense.proofpoint.com/v2/url?u=https-3A__code.google.com_p_naclports_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=RfjvEJWweAkWHLneLw1ksvf1RoobZbEIUUVtXtJgYv4&s=RvO9OeVGsfCkE0U5HJQV_pwo1s2U1qoZg2Wx-gK19cs&e=>). It has ready-made makefiles to compile a bunch of well known open source projects using the PNaCl toolchain, which is based on LLVM. Each file is compiled to IR and the LLVM linker is used to link them all together. This is a full solution, handling the standard libraries, and so on. 
> 
> 
> Eli
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150624/abd0bc27/attachment.html>


More information about the llvm-dev mailing list