Now WAMR apply symbol relocation at run time, that must load AOT code into ram.
This operation can be done at compile time, user can provide a address to let AOT compiler know the final symbol address. Then the AOT module can be written to flash and execute in place.
By this, we can save ram space and get better performance (no symbol relocation at runtime).
Then we need:
- A unified relocator
- A new mode flag
- A method to resolve symbol address at compile time
- Enhancement of wamrc
unified relocator
Now build system choose one implemtion of relocator by compile target setting :

We need let all of them avaliable in wamrc, then the relocation function need to have a unique symbol name or define a relocator like this:
struct relocator {
apply_reloc(...)
***
}
And each implemention return a relocator reference to AOT module or wamrc.
new mode flag
May we can provide a new mode like Wasm_Module_AoT_XIP and corresponding compile option, the we can disable relocator on runtime side.
enhancement of wamrc
Now wamrc use LLVM to generate target code, and then need some minor change to support run relocate operation after compile (be careful of target byte endian).
Now WAMR apply symbol relocation at run time, that must load AOT code into ram.
This operation can be done at compile time, user can provide a address to let AOT compiler know the final symbol address. Then the AOT module can be written to flash and execute in place.
By this, we can save ram space and get better performance (no symbol relocation at runtime).
Then we need:
unified relocator
Now build system choose one implemtion of relocator by compile target setting :

We need let all of them avaliable in wamrc, then the relocation function need to have a unique symbol name or define a relocator like this:
And each implemention return a relocator reference to AOT module or wamrc.
new mode flag
May we can provide a new mode like
Wasm_Module_AoT_XIPand corresponding compile option, the we can disable relocator on runtime side.enhancement of wamrc
Now wamrc use LLVM to generate target code, and then need some minor change to support run relocate operation after compile (be careful of target byte endian).