Undefined symbol error while running the pass

Hi,

When I run my pass I am getting the following error:

command used to run:

opt -load /home/batman/llvm/build/lib/libMyHello.so -MyHello <prgrm1.bc > /dev/null

Error:

Error opening ‘/home/batman/llvm/build/lib/libMyHello.so’: /home/batman/llvm/build/lib/libMyHello.so: undefined symbol: _ZTIN4llvm12FunctionPassE
-load request ignored.
opt: Unknown command line argument ‘-MyHello’. Try: ‘opt -help’
opt: Did you mean ‘-regalloc’?

What is the reason of this error ?

What is the reason of this error ?

Looks like you forgot to include "-fno-rtti" when compiling your libMyHello.so:

$ c++filt _ZTIN4llvm12FunctionPassE
typeinfo for llvm::FunctionPass

(Alternatively, if you really use RTTI you could recompile LLVM with
it enabled; it's disabled by default for performance reasons)

Cheers.

Tim.