I'm wondering if static compilation using llvm-gcc, i.e. including the library code (for example prinft) in the LLVM bytecode, is possible?
I've tried adding the -static option to the llvm-gcc4 compiler, but that doesn't seem to change much (I got the same instruction count either with or without the option).
Compiling and interpreting a small test program (hello world + a small loop), resulted in 240 dynamic instructions on bytecode level. This was obtained using lli -stats -force-interpreter on Mac OSX.
When I compile the same program on the Alpha architecture (using gcc 2.95, but that doesn't matter for these purposes), and count the amount of dynamic instructions (using instrumentation with ATOM), I get:
Apparently including the library functions (i.e. printf) in the code itself, matters a lot. I only used 2 printf calls in my test program. The test program is available on http://www.elis.ugent.be/~kehoste/hello_with_loop.c,
for anyone who would like to try.
I hope this is possible using LLVM, because otherwise it would mean LLVM is not really usefull for me. Any solutions, even compiling glibc myself, are an option.