[JITLink] How to allocate correct target memory in small code model

Hi All,
In RISCV64, if the compiler compile with small code model (mcmodel=medlow)(https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#code-models), the symbol address need to at the lower 2GiB of the RISCV64 address space. However, when the jitlink allocate target memory, it will allocate to a address out of range of the lower 2GiB of the RISCV64 address space. How can I solve this problem ?


Hi Stephen,

You’ll need to write a custom JITLinkMemoryManager that allocates memory in the low 2GiB for this to work.

See e.g.

While it’s desirable to support all code models, it sounds like medium and compact would be more generally useful. Do you know what the default code model is for RISCV64?

– Lang.