<div>Hi,</div><div><br></div><div>I need advice in instrumenting programs using liblto and gold plugin. </div><div>Specifically, I added my pass in tools/lto/LTOCodeGenerator.cpp.</div><div>My pass inserts functions (myLoad and myStore) for some load and store instructions.</div>

<div>The functions exist in a library file.</div><div><br></div><div>I found that the approach works for the example in the link:</div><div><a href="http://llvm.org/docs/GoldPlugin.html">http://llvm.org/docs/GoldPlugin.html</a></div>

<div>$ llvm-gcc -flto a.c -c -o a.o              </div><div>$ ar q a.a a.o                              </div><div>$ llvm-gcc b.c -c -o b.o                    </div><div>$ llvm-gcc -use-gold-plugin a.a b.o -L<path_to_my_lib> -l<my_lib> -o main</div>

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

<div>$ ./configure</div><div>$ make</div><div>$ make install</div><div><br></div><div>However, I cannot compile large programs with modified liblto and gold plugin.</div><div>That is because I have to specify the path to my library containing myLoad and myStore in configure and makefile.</div>

<div><br></div><div>Is there any fancy way to handle this problem?</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Sangmin</div>