viewCFG call from opt loaded shared lib

Hey everyone,

I want to call F.viewCFG() from within the shared library runOnFunction() function, but I keep getting:

opt: symbol lookup error: ../../../Debug/lib/ undefined symbol: _ZNK4llvm8Function7viewCFGEv

while using:

"opt -load ../../../Debug/lib/ -print /temp/llvm/KellyTest/test.bc"

I assume this means that I need to statically link in LLVMAnalysis.a/LLVMCodeGen.a where viewCFG is located. I changed the Makefile by adding these libs to the LLVMlibs variable and recompiled successfully. I still get the same error, though.

I look at the VERBOSE=1 output for make and the "-lLLVMAnalysis -lLLVMCodeGen" linking is not done. I tried it manually but I still get this error.

What I want to do is load using opt, and then

1. run part way through runOnFunction()
2. print out the CFG
3. modify the CFG (ie. SplitCriticalEdges or something)
4. loop to 2.

I also tried to run opt inside gdb and break at runOnfunction(). This
gives me a warning:

Function "runOnFunction" not defined.
Make breakpoint pending on future shared library load? (y or [n])

I choose y but there is no breakpoint set. If I can get this break point then I can manually call viewCFG() (once the libs are statically linked, I guess).

Any ideas,

P.S. I know that I can push Hello.cpp into the llvm/lib/Transforms/... directory, recompile and then use opt with the -hello option (then I get the graph output I want). It just takes A LONG TIME to recompile everything that depends on the Scalar lib stuff. Trying to speed up the compile-link-run cycle here.