<div dir="ltr">Hi Stephen,<div><br></div><div>You'll need to write a custom JITLinkMemoryManager that allocates memory in the low 2GiB for this to work.</div><div><br></div><div>See e.g.</div><div><a href="https://github.com/llvm/llvm-project/blob/68d6278a6e9879794850e879a036774544b49e99/llvm/tools/llvm-jitlink/llvm-jitlink.cpp#L358">https://github.com/llvm/llvm-project/blob/68d6278a6e9879794850e879a036774544b49e99/llvm/tools/llvm-jitlink/llvm-jitlink.cpp#L358</a></div><div>or</div><div><a href="https://github.com/llvm/llvm-project/blob/bf281f364757d6af8d9d8456f26d334d1eeaf575/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp#L20">https://github.com/llvm/llvm-project/blob/bf281f364757d6af8d9d8456f26d334d1eeaf575/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp#L20</a><br></div><div><br></div><div>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?</div><div><br></div><div>-- Lang.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 22, 2021 at 5:43 PM 陆旭凡 <<a href="mailto:luxufan981014@gmail.com">luxufan981014@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi All,</div>In RISCV64, if the compiler compile with small code model (mcmodel=medlow)(<a href="https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#code-models" target="_blank">https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#code-models</a>), 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 ?<br><div>Regards,</div><div>Stephen.</div></div>
</blockquote></div>