[LLVMdev] [Fwd: Re: strace for whole-program bitcodes]

Keppler, Dave dkeppler at mitre.org
Thu Oct 15 11:30:59 PDT 2009


>>> someone suggested me to use gold-plugin, I know nothing about it yet, I
>will
>>> have a try later.  Does anyone have a good solution for this problem?
>>
>> Afaik gold does not help here. I tried it and managed to only generate
>> native code.
>
>"Just" gold isn't quite good enough, because at the last final link
>steps gold will still generate native code. However, it should be
>possible to find a way to get gold to leave the merged bitcode around
>somewhere, or perhaps do something like llvm-ld. Nicholas?
>

I've had some success by adding a call to lto_codegen_write_merged_modules(cg, somePath) at the end of the gold plugin's all_symbols_read_hook() function just before it calls lto_codegen_dispose(cg).  The somePath is set via a plugin option which I patched llvm-gcc to pass through as a derivation from its -o argument.

It has worked on several mid-complexity applications I've tried so far (lighttpd, wu-ftpd, tcdump, and the sqlite library).

I would be interested in seeing more of Timo's solution.  My goal is to eventually have a way to get bitcode + lli script outputs for off the shelf applications without modifying their make files.

>The advantage of this approach is that it will potentially work with
>build systems that call ar/ld directly.
>




More information about the llvm-dev mailing list