1

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

opt -verify vv.bc -o out.bc worked fine but opt -load ../../../Release+Asserts/lib/Hello.so -hello -verify vv.bc -o out.bc is giving the same error
@techcomp bummer. I'd open a debugger and try to locate the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.