[LLVMdev] How to call native functions from bytecode run in JIT?
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon Jun 11 14:55:35 PDT 2007
On 11 Jun 2007, at 22:35, Jan Rehders wrote:
> It's inside PPCJITInfo::relocate but unfortunately I could not figure
> out anything from the source. It looks like it's calculating new
> addresses for functions which does not make much sense for a native
> function, at all
On the PPC, unconditional branches are limited to 24 bit signed
displacements. When you call a function in a program, the compiler
therefore will create a stub which will indirectly load the address
of the function (the first time it's called, usually with the help of
the dynamic linker) and then perform an indirect branch using this
calculated address. This stub will be placed close to the call site,
so the displacement to the stub will be in range.
LLVM presumably needs to generate such stubs for native functions
introduced at run time as well, which it may not yet do. I have not
looked into the code though, so I can't really say for sure what goes
wrong here.
Jonas
More information about the llvm-dev
mailing list