All the passes (even the LLVMHello.so) fail at doFinalization()

Hi all,

I find all my passes are all broken with LLVM 3.4. Then I tried out the LLVMHello.so specified in the LLVM doc,

http://llvm.org/docs/WritingAnLLVMPass.html

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?

Thanks!
Tianyin

Tried opt -verify on your module?

-eric

Oh, you mean opt -disable-verify?

Yes, it does eliminate the crashing…

Do you know what’s the problem, Eric?

Thanks a lot!
~t

No idea, I was suggesting to just run the verifier to see if it would
pinpoint what's broken about the module.

-eric

no… I guess verifier runs by default and it points to the doFinailization() function :frowning:

~t

Weird, it definitely shouldn't be crashing. How did you create your module?

-eric

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).

~t

That doesn't tell me where your module came from. How did you create
the module that you're attempting to verify?

-eric

The module is shipped with the source code, so it’s from the developers (not me).

The path in the source tree is:
llvm-3.4.2.src/lib/Transforms/Hello

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).

~t

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.

~t