[LLVMdev] Compiling whole programs to bitcode

Russell Wallace russell.wallace at gmail.com
Fri Jun 3 21:12:27 PDT 2011


With Clang, it's reasonably straightforward to compile a C/C++ file to bitcode.

Is there a way to compile a program together with all the standard
library functions it uses, to that format? That is, suppose you have
hello.c that calls printf, how would you go about generating the
bitcode representation of both the main function from hello.c, and
printf itself (plus whatever other standard library functions printf
calls)?

Or put another way, given that one answer to the above question would
be 'download the source of GNU libc, manually run Clang to compile the
whole lot to bitcode, then manually extract the bitcode versions of
the functions you are interested in,'  is there a more automated way
to do it (in the sense that a linker provides a more automated way to
do a similar job of building an executable)?



More information about the llvm-dev mailing list