<div dir="ltr">I don't care about Mach-O at all. ELF is sufficient.<div><br></div><div>I can certainly submit a bug report at <a href="https://bugs.llvm.org">https://bugs.llvm.org</a> requesting a -mcmodel=tiny feature which would cause ADR instructions to be emitted in the first place.</div><div><br></div><div>This is of great enough interest to me that I may be able to contribute some time to make it happen, but not generally working this deep in the toolchain, it would likely need to be more along the lines of assisting someone who knew what they were doing and could provide guidance rather then me taking on the whole task myself.</div><div><br></div><div>As an educated opinion, how difficult might something like this be? minutes? hours? days? weeks? months?</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 21, 2018 at 8:57 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eric,<br>
<span class=""><br>
On 21 May 2018 at 13:31, Eric Gorr via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> I am working in an embedded environment with somewhat restrictive memory<br>
> requirements where the page alignment requirements of an ADRP instruction<br>
> cannot be guaranteed.<br>
<br>
</span>It sounds like you're relying on the linker optimization hints that<br>
Clang emits. As you've seen they're designed to allow the linker to<br>
convert adrp/add pairs into simpler nop/ldr sequences. If it works for<br>
your purposes, great; but bear in mind it was designed as a<br>
microarchitectural optimization so it's not guaranteed to trigger or<br>
be able to remove all adrps if it does.<br>
<span class=""><br>
> As near as I can determine, ld.lld does not have this same feature. I am<br>
> wondering if I am missing something, if such a feature is being planned,<br>
<br>
</span>MachO support in lld is pretty immature compared to ELF and it<br>
certainly doesn't look like it's supported yet. I'm afraid I'm not<br>
sure about the longer-term plans.<br>
<span class=""><br>
> or if there is an alternative I have not considered yet.<br>
<br>
</span>Ideally this would probably be handled by implementing proper<br>
-mcmodel=tiny support in LLVM so that only ADR instructions are<br>
emitted in the first place (instead of leaving you with a bunch of<br>
NOPs). In ELF-land that probably wouldn't be too hard (there are<br>
already relocations for it in the spec), but MachO is chronically<br>
starved of free locations so that might get very nasty very quickly.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>