[LLVMdev] Linking tools

Reid Kleckner rnk at google.com
Mon Jul 27 09:52:59 PDT 2015


On Mon, Jul 27, 2015 at 7:24 AM, Russell Wallace <russell.wallace at gmail.com>
wrote:

> On Fri, Jul 10, 2015 at 11:39 PM, Eric Christopher <echristo at gmail.com>
> wrote:
>
>>
>>
>> On Fri, Jul 10, 2015 at 3:37 PM Russell Wallace <
>> russell.wallace at gmail.com> wrote:
>>
>>> I'm trying to figure out exactly what the function and status of the
>>> different linking tools is. The impression I get is:
>>>
>>> 1. For linking multiple bitcode (either binary or text format) files
>>> together, llvm-link is the current and future intended tool.
>>>
>>> 2. For converting bitcode files into (machine code) object files, llc is
>>> the current and future intended tool.
>>>
>>>
>> llvm-link and llc are developer tools only. clang is designed to be the
>> interface here (or your language specific driver).
>>
>
> Okay so for linking bitcode files together, what's the intended command?
> That is, 'clang x.bc y.bc' will generate an executable, but for generating
> a single larger bitcode file? Adding -emit-llvm gives an error unless you
> also add -c, but that just rewrites the original small bitcode files?
>

I think your original description of the situation is accurate. llvm-link
will take multiple bitcode files and spit out a big ball o' bitcode, but
that's usually not sufficient for LTO, which is the main use case that we
want to support. From the perspective of LTO, we just want users to be able
to add -flto to their compile and link lines, and make that produce a
faster executable, without the user ever being aware of the bitcode.

If your use case (static analysis, maybe?) requires the intermediate
bitcode, we don't yet have a nice way to get that from clang and maybe we
should add one. Maybe -emit-llvm on a link line like you suggested, but
that discards information about non-bitcode object files.

Anyway, for now, llvm-link will do the job, but it isn't really meant to be
a user facing tool.

Hope that explains things. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150727/2a86a7b4/attachment.html>


More information about the llvm-dev mailing list