Comment 7 for bug 513735

Revision history for this message
Xerxes RĂ„nby (xranby) wrote :

@Dave
Here comes the answer to if we can use -marm explained by jyasskin on #llvm
"If you put a CallInst in your LLVM IR whose target is an llvm::Function, and that Function is an external declaration (i.e containing no BasicBlocks), then llvm will try to use dlsym() to look up the code for that function.
If, however, you first call ExecutionEngine::addGlobalMapping(f, &some_real_function), then the JIT will emit calls to some_real_function(...) instead."

So we will have trouble fullfill the 1.a condition that external functions should only be called via C++/high-level code which is part of llvm itself since the JIT will call these functions directly.

If the JIT runs openjdk shark then it will call jni code directly, make direct calls to libjvm.so.

Some clarification to your guess "I'm guessing that the JIT output is ARM code only (not Thumb)":
It turned out that the LLVM switches on the thumb backend by default since it have autodetected the host system to be a
Host: thumb-unknown-linux-gnueabi

The current implementation of the llvm thumb backend currently works well when using llvm as a static compiler to create assembler files:

But dont work so well when used for the ExecutionEngine JIT since the thumb backend happen to lack specifications for how to generate machine code fore all the thumb instructions. It currently only know what instruction it wants to use but then hits an assertion that the specification for the machine code are missing: This bug are tracked upstream http://llvm.org/bugs/show_bug.cgi?id=6223

example: see attached file for differences between the static compilation and jit using llc and lli with thumb/tumb2 emission.