I would like to generate a free function that can be written to disk
and then I can mmap it later.
The function I'm going to generate is highly restrictive. It will use
the host C calling convention. It features no global variables, no
data references outside parameters and local variables.The parameters
to the function are all pointer sized integers. No exceptions support
Call instructions emitted inside the code will always be done through
a dispatch that is based on a parameter, i.e. some sort of vtable or
interface dispatch whose setup is take care a priori.
I'm expecting that LLVM will generate code that given my restrictions
will be something I can mmap to any suitable aligned address and call
I haven't tried all of the above, but I intend to soon. I'm emailing
this list in the hopes that somebody has done this before and can tell
me it won't work or work with some suitable options set, etc.