Running LLVM JIT on qemu-system-arm

Hi all,

I'm struggling to get lli work on qemu-system-arm. I already boot the system
with a debian squeeze rootfs which contains a statically cross-compiled lli
for armel. When I run ./lli hello.bc, I got the following error msg:

./lli: error creating EE: /lib/: cannot read file data: Is a directory

afaik, this error is related to lli using dlopen() with a NULL path to
resolve symbols for the main program (lli program) itself. This happens when
lli initially tries to create an ExecutionEngine ("EE = builder.create();"
in lli.cpp), which leads to "if
(sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr)" in
ExecutionEngine.cpp.

Could anyone tell me how to resolve this?

Thanks in advance!
Toan Mai.

Hi Toan,

The JIT for ARM (non-darwin) is completely broken and you should not expect
it to work in its current state.

Cheers,

James

Hi James,

Thanks for your information.
Could you suggest any other framework that I could use for making a custom JIT for ARM?
I am doing research on JIT compilation for a heterogeneous processor system.

Best,
Toan Mai

Thanks for your information.
Could you suggest any other framework that I could use for making a custom JIT
for ARM?
I am doing research on JIT compilation for a heterogeneous processor system.

  If not for heterogeneous system, I would suggest QEMU. :slight_smile:
Why not try to fix it?

Regards,
chenwj

Could you tell me the current status of MIPS JIT?

Thanks for your information.
Could you suggest any other framework that I could use for making a custom JIT
for ARM?
I am doing research on JIT compilation for a heterogeneous processor system.

If not for heterogeneous system, I would suggest QEMU. :slight_smile:
Why not try to fix it?

I’m afraid it’s not straightforward to fix it, Chen.

Could you tell me the current status of MIPS JIT?

  According to [1], the support for "old-style" JIT is complete.
You can give it a shot.

I'm afraid it's not straightforward to fix it, Chen.

  Well, no pain no gain. :wink:

Regards,
chenwj

[1] http://llvm.org/releases/3.0/docs/ReleaseNotes.html#whatsnew

I have compiled lli to run on qemu-system-mips and got the error “Illegal instruction” as follows.

ecl$ ./llis mipshello.bc
0 0x7f836770 + 2139318128
1 lli 0x01879918
Stack dump:
0. Program arguments: ./lli mipshello.bc
Illegal instruction

I used gdb to trace the execution and saw that in JIT::runFunction() (JIT.cpp), after compiling the “main” function, the JIT failed to execute it

else if (BitWidth <= 32)
rv.IntVal = APInt(BitWidth, ((int(*)())(intptr_t)FPtr)());

Seems like the code emitter produced a wrong binary for MIPS? It’s weird because the release notes state that the old-style JIT for MIPS is complete.

I compiled hello.c using this command:
$ clang -emit-llvm -c -o mipshello.bc -ccc-host-triple mips-unkown-linux -ccc-clang-archs mips hello.c

Did I do anything wrong or miss something?
Is there any guide or example for running JIT on MIPS?
Thanks,