<div dir="ltr">I went ahead a submitted a bug report, referencing this discussion. <div><br></div><div>For anyone who is interested and would like to comment to add useful clarifications, etc., the link to the report is:</div><div><br></div><div><a href="https://bugs.llvm.org/show_bug.cgi?id=37543">https://bugs.llvm.org/show_bug.cgi?id=37543</a><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 21, 2018 at 10:34 AM, Peter Smith <span dir="ltr"><<a href="mailto:peter.smith@linaro.org" target="_blank">peter.smith@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Eric,<br>
<br>
If you do decide to investigate the linker script route, the ALIGN<br>
builitin function might be useful. I think the simplest way is to do<br>
something like:<br>
.text ALIGN(0x1000) : { *(.text) }<br>
.my_next_section ALIGN (0x1000) : { *(my_next_section) }<br>
Bothe .text and .my_next_section would start at 4k boundaries.<br>
<br>
Link to docs: <a href="https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#Builtin-Functions" rel="noreferrer" target="_blank">https://sourceware.org/<wbr>binutils/docs/ld/Builtin-<wbr>Functions.html#Builtin-<wbr>Functions</a><br>
<span class="HOEnZb"><font color="#888888"><br>
Peter<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 21 May 2018 at 14:23, Eric Gorr via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Thank you for providing the explanation for how ADRP works...something I<br>
> should have done myself.<br>
><br>
> With this explanation in hand, one other alternative I was looking at was<br>
> using a linkerscript to essentially rebase the code and have ADRP<br>
> instructions that would address the correct location as a result. However, I<br>
> am not a linkerscript expert, so I am not sure if such a thing is even<br>
> possible or would make much sense. However, it may provide a legitimate<br>
> shortcut to a solution which doesn't involve adding a feature to the<br>
> toolchain.<br>
><br>
><br>
> On Mon, May 21, 2018 at 9:04 AM, Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On 21 May 2018 at 13:57, Bruce Hoult via llvm-dev<br>
>> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> > "ADRL produces position-independent code, because the address is<br>
>> > calculated<br>
>> > relative to PC."<br>
>> ><br>
>> > From this, I'd expect ADRP to simply do Xd <- PC + n*4096, where n is a<br>
>> > 20<br>
>> > bit number, just like AUIPC in RISC-V (also a 20 literal multiplied by<br>
>> > 4096)<br>
>> > or AUIPC in MIPS (16 bits multiplied by 65636 there).<br>
>><br>
>> Afraid not. It really is (PC & ~0xfff) + n * 0x1000. So it does<br>
>> require 12-bit alignment of any code section.<br>
>><br>
>> Now that you mention the MIPS & RISC-V alternatives, I'm not sure why<br>
>> ARM actually made that choice. It obviously saves you a handful of<br>
>> transistors but I can't quite believe that's all there is to it.<br>
>><br>
>> Cheers.<br>
>><br>
>> Tim.<br>
><br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> ______________________________<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>
</div></div></blockquote></div><br></div>