[LLVMdev] Dynamically loading native code generated from LLVM IR

Tim Northover t.p.northover at gmail.com
Fri Oct 12 05:42:54 PDT 2012


Hi Armin,

> OK ... I have a similar issue. What happens if the code located in the .o
> file has references to external libs?

If you use dlopen or getPermanentLibrary to open those libraries then
the JIT's relocation processing will normally find the referenced
symbols correctly. (With caveats for remote targets and so on, of
course).

That solution assumes your external libraries are shared, of course.
If they're static then I'm not sure there's a solution at present.
There's no reason in principle why the JIT couldn't load prebuilt
objects or archives, but it doesn't even seem to support multiple LLVM
modules at the moment, so infrastructure is probably missing.

Tim.



More information about the llvm-dev mailing list