Building VMKit

I tried to build VMKit on an ARM device today (a Sheevaplug - armv5te)
(native, not cross compiled), and got this error:

llvm[3]: Building LLVM assembly with
/home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime/LLVMAssembly.ll
/home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime/LLVMAssembly64.ll
ExpandIntegerResult #0: 0x16fbf88: i64,ch = AtomicCmpSwap 0x16e8d84,
0x16fbf00, 0x16fc3c8, 0x16fc1a8<Volatile LDST8[%ptr]> [ORD=4] [ID=0]

Do not know how to expand the result of this operator!
UNREACHABLE executed at LegalizeIntegerTypes.cpp:982!
Stack dump:
0. Program arguments:
/home/debio/build/vmkit-build/vmkit/../llvm//Debug+Asserts/bin/llc -o
LLVMAssembly.s
1. Running pass 'Function Pass Manager' on module '<stdin>'.
2. Running pass 'ARM Instruction Selection' on function
'@llvm_atomic_cmp_swap_i64'
/bin/sh: line 1: 16944 Done
/home/debio/build/vmkit-build/vmkit/../llvm//Debug+Asserts/bin/llvm-as
-f LLVMAssembly.gen.ll -o -
     16945 Aborted |
/home/debio/build/vmkit-build/vmkit/../llvm//Debug+Asserts/bin/llc -o
LLVMAssembly.s
make[3]: *** [LLVMAssembly.s] Error 134
make[3]: Leaving directory `/home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/debio/build/vmkit-build/vmkit/lib/Mvm'
make[1]: *** [Mvm/.makeall] Error 2
make[1]: Leaving directory `/home/debio/build/vmkit-build/vmkit/lib'
make: *** [all] Error 1

I was following the instructions from
http://vmkit.llvm.org/get_started.html although I didn't build my own
classpath, as I have a packaged version installed and I was waiting to
see whether configure would pick it up automatically. From what I can
tell, that doesn't seem relevant to this error.
Is this something that just isn't supported on my platform, is the
trunk build currently broken somehow, or am I just doing it wrong?

Thanks,
Andrew Wiley

Hi Andrew,

Note that I never tried compiling vmkit on ARM. From the error message you get, it looks to me that the LLVMAssembly64.ll is wrongly being compiled. You should change the configure script to not include it in the list of files to compile (or you could also just remove the code in the file).

Let me know if it helps!
Nicolas

I tried to build VMKit on an ARM device today (a Sheevaplug - armv5te)
(native, not cross compiled), and got this error:

llvm[3]: Building LLVM assembly with
/home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime/LLVMAssembly.ll
/home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime/LLVMAssembly64.ll
ExpandIntegerResult #0: 0x16fbf88: i64,ch = AtomicCmpSwap 0x16e8d84,
0x16fbf00, 0x16fc3c8, 0x16fc1a8<Volatile LDST8[%ptr]> [ORD=4] [ID=0]

Do not know how to expand the result of this operator!
UNREACHABLE executed at LegalizeIntegerTypes.cpp:982!
Stack dump:
0. Program arguments:
/home/debio/build/vmkit-build/vmkit/../llvm//Debug+Asserts/bin/llc -o
LLVMAssembly.s
1. Running pass 'Function Pass Manager' on module '<stdin>'.
2. Running pass 'ARM Instruction Selection' on function
'@llvm_atomic_cmp_swap_i64'

Hi this JIT bug are a long standing unimplemented issue on ARM.
http://llvm.org/bugs/show_bug.cgi?id=3877

I was following the instructions from
http://vmkit.llvm.org/get_started.html although I didn't build my own
classpath, as I have a packaged version installed and I was waiting to
see whether configure would pick it up automatically. From what I can
tell, that doesn't seem relevant to this error.
Is this something that just isn't supported on my platform, is the
trunk build currently broken somehow, or am I just doing it wrong?

Thanks,
Andrew Wiley

To fix this you have to implement the missing atomic intrinsics on ARM.

Gary Benson did implement the missing intrinsics on PPC in 2008 and you might use this old conversation thread to guide you on how to implement it on ARM.
http://markmail.org/message/73owc5nrvsbmrhes#query:+page:1+mid:73owc5nrvsbmrhes+state:results

Before ARMv7 there exist a SWP instruction.
On ARMv7 and later you can use LDREX and STREX instructions.

Cheers
Xerxes

Andrew Wiley <debio264 <at> gmail.com> writes:

Thanks,
Andrew Wiley

Hi ! Don't use OpenJDK on your device. And also install ant.