[LLVMdev] Instrumentation with liblto and gold

Sangmin Park sangmin.park at gmail.com
Thu Mar 24 16:23:49 PDT 2011


Hi,

I need advice in instrumenting programs using liblto and gold plugin.
Specifically, I added my pass in tools/lto/LTOCodeGenerator.cpp.
My pass inserts functions (myLoad and myStore) for some load and store
instructions.
The functions exist in a library file.

I found that the approach works for the example in the link:
http://llvm.org/docs/GoldPlugin.html
$ llvm-gcc -flto a.c -c -o a.o
$ ar q a.a a.o
$ llvm-gcc b.c -c -o b.o
$ llvm-gcc -use-gold-plugin a.a b.o -L<path_to_my_lib> -l<my_lib> -o main

I also found that I can compile large programs (apache and mysql) with gold
plugin.
Here is the command:
$ export CC="llvm-gcc -use-gold-plugin"; export CXX="llvm-g++
-use-gold-plugin"; export RANLIB=/bin/true; export CFLAGS="-O4";
$ ./configure
$ make
$ make install

However, I cannot compile large programs with modified liblto and gold
plugin.
That is because I have to specify the path to my library containing myLoad
and myStore in configure and makefile.

Is there any fancy way to handle this problem?

Thanks in advance.

Sangmin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110324/a807a3ca/attachment.html>


More information about the llvm-dev mailing list