[LLVMdev] Re: standalone llvm

Oscar Fuentes
Fri, 14 Apr 2006 02:05:10 -0000

Simon Burton <simon at arrowtheory.com> writes:

>> 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).
>
> Well, it's not NULL:
>
> (gdb) print add1
> $1 = (int (*)(int)) 0x83e43b8
> (gdb) print ((char*)add1)
> $2 = 0x83e43b8 "h\2245\b\002"

Dissamsembling that address would reveal if llvm really created binary
code for your function.

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

This indicates that the JIT is not working and your code is being
interpreted. I don't know about "llvm-config --libs jit" you are
using
but I would try adding LLVMJIT.o to your link command the same way you
do with LLVMInterpreter.o

Oh, and renaming your llvmjit.cpp to something else, just in case. (Is
the linker case-sensitive?)

--
Oscar