[cfe-dev] Linking LLVM bitcode from clang driver

Nicolay Haustov via cfe-dev cfe-dev at lists.llvm.org
Tue May 17 09:59:19 PDT 2016


Currently, -emit-llvm can only be used when compiling (-c) and not when
linking. I think such feature would be useful. I also think it would nicely
corresponds to existing functionality:

Compile each input file to object:
clang -c file1.cl file2.cl

Compile each input file to object and link objects together:
clang -c file1.cl file2.cl

Compile each input file to bitcode:
clang -emit-llvm -c file1.cl file2.cl

Compile each input file to bitcode and link bitcodes together (this
currently gives error):
clang -emit-llvm file1.cl file2.cl

Is there any interest in such feature? Any objections/additional
considerations?

Some background: we are trying to use Clang driver API to compile OpenCL to
bitcode. This is easy to do for one source, however for multiple source
files, there currently has to be a call for each source and then llvm-link
to link them together (invoked separately from Clang driver API). Unifying
this workflow would be good.

Nikolay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160517/16a860cf/attachment.html>


More information about the cfe-dev mailing list