<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Dana,<div><br></div><div>Committed as <a href="https://github.com/llvm/llvm-project/commit/574713c3076c11a5677f554ab132d1324be9cb00">https://github.com/llvm/llvm-project/commit/574713c3076c11a5677f554ab132d1324be9cb00</a>.</div><div><br></div><div>Thanks again for the patch!</div><div><br></div><div>Regards,</div><div>Lang.</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 17, 2020 at 11:47 AM Dana Koch <<a href="mailto:dsk@google.com">dsk@google.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">Please commit on my behalf. Thanks!<br>
<br>
On Mon, Jul 13, 2020 at 4:28 PM Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>> wrote:<br>
><br>
> Hi Dana,<br>
><br>
> Thanks for your patience. This looks good to me. Do you have commit access, or would you like me to commit on your behalf?<br>
><br>
> Regards,<br>
> Lang.<br>
><br>
><br>
><br>
> On Mon, Jun 29, 2020 at 1:20 PM Dana Koch <<a href="mailto:dsk@google.com" target="_blank">dsk@google.com</a>> wrote:<br>
>><br>
>> JITted code may include relocations between sections, and the<br>
>> relocations often chosen to do this are 32-bit PC-relative relocation<br>
>> types. Thus, consideration must be made to ensure sections are allocated<br>
>> sufficiently close to one another.<br>
>><br>
>> The SectionMemoryManager provides three memory groups, one for Code<br>
>> data, one for ROData, and one for RWdata. Sections are allocated with<br>
>> mmap (via allocateMappedMemory) which allows the caller to provide a<br>
>> hint to the system to suggest where to position mmap'ped memory. A<br>
>> memory group has a Near block which lets successive allocations to that<br>
>> memory group be positioned near other mappings in that group via the<br>
>> mmap hint. Initially, this Near block is empty, that is, its address is<br>
>> nullptr. When mmap is passed a nullptr hint, the system may choose any<br>
>> location to position the mapping.<br>
>><br>
>> This means, prior to this commit, the first Code section mapping, ROData<br>
>> section mapping, and RWData section mapping will all be placed at a<br>
>> location of the system's choosing, and the system may choose distant<br>
>> enough locations in memory such that a 32-bit PC-relative relocation<br>
>> would overflow.<br>
>><br>
>> Therefore, once allocateMappedMemory allocates the first mapping, copy<br>
>> that Near block hint to the other memory groups. This ensures that<br>
>> sections are allocated close to another so relative relocations are less<br>
>> likely to overflow.<br>
</blockquote></div>