Access a specific address in the JIT compiler


I am using the JIT compiler to execute code that must interface with
the running process.
I would like to access some specific addresses.

The solution I found is to create a global variable for each address I
want to reference, and pass it as a mapping to the ExecutionEngine
with addGlobalMapping.

Is that how I should do this?
Is there no way to just reference the addresses with constants?


This seems to be the “proper” way to do that.

Another possibility, is to create a ConstantInt with the size of the pointer (found in TargetData), then do a IntToPtr cast, and use this absolute address in load/store/call.


Thanks Olivier, this is what I was looking for.