<div dir="ltr">Are you sure about that?<div><br></div><div>In the documentation for the ADRL pseudo it says:</div><div><br></div><div>"ADRL assembles to two instructions, an ADRP followed by ADD."</div><div><br></div><div>"ADRL produces position-independent code, because the address is calculated relative to PC."</div><div><br></div><div>From this, I'd expect ADRP to simply do Xd <- PC + n*4096, where n is a 20 bit number, just like AUIPC in RISC-V (also a 20 literal multiplied by 4096) or AUIPC in MIPS (16 bits multiplied by 65636 there).</div><div><br></div><div>In all cases, if you then do an add immediate with a 12 bit signed literal (16 bit for MIPS) then you've got a relative offset from the current PC< accurate to the byte, anywhere in a +/- 2 GB range.</div><div><br></div><div>The actual alignment of the PC is irrelevant. It's not like the ADRP or AUIPC sets the low 12 bits to zero or something. It leaves them alone (as it finds them in the PC).</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 22, 2018 at 12:31 AM, Eric Gorr via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I am working in an embedded environment with somewhat restrictive memory requirements where the page alignment requirements of an ADRP instruction cannot be guaranteed.</div><div><br></div><div>With the ld program inside of the Xcode, there is a -preload flag which causes ADRP instructions to be dropped, and generates code that is 100% position independent. </div><div><br></div><div>As near as I can determine, ld.lld does not have this same feature. I am wondering if I am missing something, if such a feature is being planned, or if there is an alternative I have not considered yet.</div><div><br></div><div>Regards,</div><div>Eric</div><div><br></div><div><br></div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>