Reputation: 400
when i am trying to run the very simple (Hello world) pass given in llvm (my file is pass Hello.cpp) on a file XX.c (X64 OS) the opt command
opt -load ../../../Release+Asserts/lib/Hello.so -hello vv.bc > vv.txt
gives this error
0 libLLVM-3.2svn.so 0x00007f314b0f1e52
1 libLLVM-3.2svn.so 0x00007f314b0f22b3
2 libpthread.so.0 0x00007f314a0c7340
3 libstdc++.so.6 0x00007f31499645cb std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) + 11
4 libLLVM-3.2svn.so 0x00007f314aadef1d llvm::createPrintFunctionPass(std::string const&, llvm::raw_ostream*, bool) + 77
5 libLLVM-3.2svn.so 0x00007f314aad1585 llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 37
6 opt 0x0000000000413e4f main + 4767
7 libc.so.6 0x00007f31492eeec5 __libc_start_main + 245
8 opt 0x000000000040dfca
Stack dump:
0. Program arguments: opt -load ../../../Release+Asserts/lib/Hello.so -hello vv.bc
Segmentation fault (core dumped)
any suggestion would be appreciable. I am new to both Linux and llvm
Upvotes: 1
Views: 1161
Reputation: 26868
Something I found extremely useful is to use the verifier pass.
So first, make sure basic opt
flow works as intended, and that the input file is legal:
opt -verify vv.bc -o out.bc
Then make sure your pass results in a legal module:
opt -load ../../../Release+Asserts/lib/Hello.so -hello -verify vv.bc -o out.bc
If that still won't help, I'd fire up the debugger.
Upvotes: 1