[LLVMdev] Re: standalone llvm

Oscar Fuentes oscarfv at telefonica.net
Thu Apr 13 18:25:39 PDT 2006


Simon Burton <simon at arrowtheory.com> writes:

> I'm using llvm CVS, and manage to compile/link OK. Yes I include JIT.h.
> The program segfaults when it gets to calling the function pointer.
>
>>From the Makefile:
>
> llvmjit: llvmjit.o
> 	g++ llvmjit.o /home//users//simonb//lib/LLVMAsmParser.o /home//users//simonb//lib/LLVMInterpreter.o `llvm-config --ldflags` `llvm-config --libs jit` -lpthread -ldl -o llvmjit
>
> llvmjit.o: llvmjit.cpp
> 	g++   `llvm-config --cxxflags` -c llvmjit.cpp
>
>
> Complete source (i added a call to verifyModule):

[snip]

Simon,

With a fresh CVS checkout, I've tried your test case on Windows/VC++
and it works ok. Too bad that I have not access to a Linux machine
right now. I'll like to see what's wrong with your test case.

What you get from running the test case under gdb and inspecting the
value of add1 just before the function invocation?

There are several possibilities here: either add1 is assigned a NULL
pointer, or LLVM was unable to use the JIT and generates bytecode
instead of native code, or invalid native code was generated
(unlikely).

What happens when you execute your function the same way the Fibonacci
example does? (See examples/Fibonacci/fibonacci.cpp line 112).

-- 
Oscar




More information about the llvm-dev mailing list