I would like to produce a file that I can load into memory (for example with mmap) and then jump to the start of that memory to run the code.
Ideally, I'd like the option of either making the code relocatable (which might be inefficient) or specifying an explicit address that the code expects to be loaded at (which is a pain), but either one would probably work fine on its own.