[llvm-dev] JIT compiler, Windows, external functions like cos
Machiel van Hooren via llvm-dev
llvm-dev at lists.llvm.org
Wed Jan 2 13:31:27 PST 2019
I ran into the same/similar issue a while ago (and posted the same question
here) but since I got no response I eventually came up with the following
Create a JITDylib containing absolute addresses to all your runtime
functions like cosf, sinf, etc and then link that JITDylib to each new
JITDylib that needs those functions.
This can be done by defining some absolute symbols as follows:
functionFlags |= llvm::JITSymbolFlags::Callable;
functionFlags |= llvm::JITSymbolFlags::Exported;
functionFlags |= llvm::JITSymbolFlags::Absolute;
//This will map the "sinf" symbol to the absolute address of std::sinf
//Do this for every runtime library symbol that you need.
//Create your runtime dylib and define the absolute symbols
llvm::orc::JITDylib& runtimeLibraryDyLib =
Then on the JITDylib that you are building:
Another crash/issue you may run into on Windows that is related to your
question is described in this bug report (there is a workaround):
You may already be doing this, but on Windows you also need to enable some
workarounds on your RTDyldObjectLinkingLayer in order for your compiled
function symbols to be found at all:
I hope this helps.
Machiel van Hooren
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev