[LLVMdev] How to use profiling runtime for program profiling?
Christian Plessl
christian at plesslweb.ch
Wed Jan 30 01:23:31 PST 2008
Hi Haifeng
> I have a question about how to profile program with LLVM. When I tried
> to compile the instrumented version of program after using "-insert-
> block-profiling", I got
> error complaining " undefined reference to
> `llvm_start_block_profiling'.
>
> I found that there is a "runtime"directory in llvm source directory
> but in the Makefile, it said llvm gcc 4 and above already included
> the libraries. I was using llvm
> gcc 4. Why would I still get the error?
I experienced the same error on Mac OS X when using the binary
distribution of llvm-gcc 4.0 and building llvm from SVN head. It seems
that the comment in the Makefile is wrong. I had to explicitly build
the runtime using 'make -C runtime install'.
You will also find the utils/profile.pl script useful, which passes
profiling options to opt for instrumenting the bytecode and calls lli
with the correct arguments and paths for loading the profiling library
profile_rt.so (which defines 'llvm_start_block_profiling' etc.)
Best regards,
Christian
More information about the llvm-dev
mailing list