So I need a call graph pass and having done several other passes, I went to work on a simple pass, inheriting from CallGraphSCCPass.
However, while I was quickly able to build the pass, when I went to run it I got the following:
opt -load ../Passes/HierchalFunctions/Hierchal/hierchal.dylib -hierchal < hello.bc > /dev/null
Error opening '../Passes/HierchalFunctions/Hierchal/hierchal.dylib': dlopen(../Passes/HierchalFunctions/Hierchal/hierchal.dylib, 9): Symbol not found: __ZTIN4llvm16CallGraphSCCPassE
Referenced from: /Users/jcarlson/Software/LLDB/Passes/HierchalFunctions/Hierchal/hierchal.dylib
Expected in: flat namespace
-load request ignored.
opt: Unknown command line argument '-hierchal'. Try: 'opt -help'
opt: Did you mean '-verify'?
It was suggested that I might have forgotten to link in the ipa lib so I tried to modify my cmakelists and then even ran by hand:
/usr/local/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -Wl,-flat_namespace -Wl,-undefined -Wl,suppress -o hierchal.dylib -install_name /Users/jcarlson/Software/LLDB/Passes/HierchalFunctions/Hierchal/hierchal.dylib CMakeFiles/hierchal.dir/Hierchal.o -L/usr/local/lib -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMMC -lLLVMObject -lLLVMSupport -lpthread
When I run otool -l on the dylib I get:
otool -L hierchal.dylib
/Users/jcarlson/Software/LLDB/Passes/HierchalFunctions/Hierchal/hierchal.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
I have the feeling I'm just missing something simple but I've been banging my head on this for a bit now… Any suggestions?