[llvm-dev] Serializing a single function to disk

Hayden Livingston via llvm-dev llvm-dev at lists.llvm.org
Sat May 12 16:24:02 PDT 2018


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
required.

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
into.

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.


More information about the llvm-dev mailing list