When I declare some functions in my IR code which belongs to the C standard library(
printf for example), the JIT will report that symbol cannot found.
So is there any way I can add these libraries to my JIT?
P.S. When I using
printf will work, I guess
lli is a JIT(right?) and it somehow knows where to find the symbol
+Lang Hames , JITer of JITs.
I believe there’s some kind of resolver you can add that finds symbols in the current process. Yes, lli uses some of the same pieces of JIT infrastructure so you could go look at its source code to see how it’s managing this.
As david told, you can make the symbols of your host process visible to the JIT’d code through DynamicLibrarySearchGenerator::getForCurrentProcess.
Thanks Praveen, it works.