[cfe-dev] how to generate both IR and object file

Alp Toker alp at nuanti.com
Sun Jun 22 02:22:17 PDT 2014


On 19/06/2014 23:38, Jinwook Shin wrote:
> Hi,
>
> I use the -emit-llvm flag to generate IR files and use LTO to link them together to produce the final executable. Sometimes LTO gives me link-time errors, so I want to avoid using it, yet I need IR files.
>
> Question: Is there a way to instruct clang to generate *both* an IR file and a regular object file at compile-time, and during the link time, use the object files only, while leaving out the IR files?

That isn't supported by the standard driver and frontend but it's a 
perfectly reasonable feature to request.

It's missing mostly for historical reasons -- the frontend action 
pipeline wasn't designed to be composable, meaning you can only do one 
thing per invocation.

The limitation doesn't apply if you use the clang C++ API to build a 
custom tool.

Alp.


>
> Thanks,
> JS
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list