Hello everyone and Lang,
I have another design or “how-to” question about the ORC JIT. Sorry for having so many about them, to me this is a really complicated yet fascinating subject…
How would I design an ORC JIT with the following requirements?
At any time it should be possible to load a LLVM Module, every Module is independent and is not allowed to be linked with the other modules, every module can be removed at any time.
My first idea was to have an ORC JIT for every module I load, but then I wondered if I could use a single ORC JIT for it.
So, I would create an ORC JIT:
-
using llvm::orc::LLJITBuilder
-
configurating it
-
adding a custom memory manager that requests the entire memory size
Then I would call “getMainJITDylib” and fill it with symbols that are valid for every module:
- adding printf, strlen, usw.
Now when I get a request to load a module:
-
load module
-
get symbols I want to look up
-
create new DyLib and add module to that
Now I would do a lookup on that module, plus the main module to get symbol addresses and stuff
If a new module is added, it goes to a new DyLib as well and so on.