I'm working on a runtime-modification API for native code, and I'd like to let modders write one piece of code that can work with the target binary on any of its platforms. To do this, I'll need to have them compile to some kind of platform-agnostic intermediary and then have my program natively-compile it on-site.
I know the JVM actually does something very similar to this with its native compilation tools, and since there are already JVMs for each possible platform, I could save a lot of effort by using functionality that already exists.
Is there a way to interface with the system the JVM uses to assemble code to native instructions?