I find all my passes are all broken with LLVM 3.4. Then I tried out the LLVMHello.so specified in the LLVM doc,
and it also crashes.
It seems all the functions in the pass do work, but LLVM crashes in the doFinalization() step.
Does anyone know this problem?
Tried opt -verify on your module?
Oh, you mean opt -disable-verify?
Yes, it does eliminate the crashing…
Do you know what’s the problem, Eric?
Thanks a lot!
No idea, I was suggesting to just run the verifier to see if it would
pinpoint what's broken about the module.
no… I guess verifier runs by default and it points to the doFinailization() function
Weird, it definitely shouldn't be crashing. How did you create your module?
I just follow the tutorial: http://llvm.org/docs/WritingAnLLVMPass.html
Actually it’s not only my module, I used the LLVMHello.so (a sample module in the source tree) and get the crash (I didn’t do anything :-P).
That doesn't tell me where your module came from. How did you create
the module that you're attempting to verify?
The module is shipped with the source code, so it’s from the developers (not me).
The path in the source tree is:
After compiled LLVM
#./configure --prefix=XXX --with-binutils-include=/path-to-binutils-2.24/include --enable-debug-symbols --enable-debug-runtime --enable-assertions --disable-optimized; make; make install
LLVMHello.so is generated at llvm-3.4.2.src/Debug+Asserts/lib
According to the tutorial, the following command should be called to invoke it,
#opt -load …/…/…/Debug+Asserts/lib/Hello.so -hello < hello.bc > /dev/null
(and verify will be invoked by default).
How did you create hello.bc?
Use the gold plugin stuff,
first use clang -flto to generate the bitcode file for each source file,
and then use ld.gold to link different files together.