Haifeng He
2008-Jan-30 06:46 UTC
[LLVMdev] How to use profiling runtime for program profiling?
Hi, all 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? Thanks Haifeng
Christian Plessl
2008-Jan-30 09:23 UTC
[LLVMdev] How to use profiling runtime for program profiling?
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
Haifeng He
2008-Feb-01 02:06 UTC
[LLVMdev] How to use profiling runtime for program profiling?
Thank for the reply. It works if I link the runtime library manually. Best, Haifeng On Jan 30, 2008 2:23 AM, Christian Plessl <christian at plesslweb.ch> wrote:> 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 > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Haifeng He
2008-Feb-01 02:07 UTC
[LLVMdev] How to use profiling runtime for program profiling?
Thanks. It works if I link the runtime manually. Haifeng On Jan 30, 2008 2:23 AM, Christian Plessl <christian at plesslweb.ch> wrote:> 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 > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >