<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60534>60534</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld] feasibility of `.loh` linker optimization hints on elf platforms
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld,
backend:AArch64,
lld:ELF
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
I noticed that clang on macos is emitting `.loh` assembler directives. I couldn't find much documentation on these, but it seems there's some logic implemented in llvm/include/llvm/MC/MCLinkerOptimizationHint.h.
It looks like the linker is able to fold:
```asm
Lloh0:
adrp x0, lhello@PAGE
Lloh1:
add x0, x0, lhello@PAGEOFF
.loh AdrpAdd Lloh0, Lloh1
```
```asm
adr x0, #36
nop
```
I don't understand what `#36` is. Is that some kind of slot that the loader will relocate? `llvm-objdump -dr` and `otool -tVr` don't show any kind of specifial relocations for these.
cc @TNorthover @MaskRay @smithp35
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VF1vrDYQ_TXmZZSVMQu7-8DDNrm0kXJ7q6rqu7GHZe4aD7JN0vTXV4Y02ajVlZAFx_M956BjpItHbEX9k6gfCr2kkUPryVwtRr04Txhi0bN9bR_BcyKDFtKoExin_QXYw6QNR6AIOFFK5C8gGrlzPIpGgo4Rp95hAEsBTaJnjDuARzC8OOuFOiQYyFuYFjOCZbNM6JNOxD7HTiNGFOoe-iUBJYiIU8xoQKEOESJPCI4vZICm2WF2RgvkwbnnSaiOvHGLRaG6N-Dr_Xo8kb9i-DYnmujvNd0v5NNu3An5IOR5Ox8TOOZrBEdXzFnBrW65Wd07hMQwsLOienMQjdweHacNeXI8yvd7bcMMf8nckBvRORZ7-dv55y8ftuWNrYU32__x-NZ1m1keNJxtmM_WwpZN3cMW6nNNt539t1Btg5CnLZNQVdVssOf5B2EewfK2w8VbDDFpb-ElsyMbrlEaCbRuPG60WTd2zRvnAaLjtMHrcFlbDPBCzkFAx0YnFFWXY-Xl3XH_3S7TDHc2rNTyNl9xYnZwl_5cwX_riSO_gPavH6lmNDSQfg9N7CMMHDaOfdq7MSD28o9fOaSRnzHkr686Xn_Xr_k1TpTGuaqhsG1lT9VJF9iWzaGum_p4KouxrY8oa7nvS3U6VKUdTntU5WCHY1mr2vSHglolVSWVrKWqj2W5O5THg2nKHpuqKnXZiL3ESZPb5c53HC4Fxbhg28i62hdO9-jiKlqlnLNCKaHuhVK9Nlf0mZDnczBjs3-_cStNvzx1GakfitCuM-2XSxR76Sim-JErUXLrPyF71Q8woI7Uk6P0mmd5o-83QfCNkGAkn2JWL7oBZqfTwGGKxRJcO6Y0x0xx1QnVXSiNS78zPH3oc61qDvwdTcr6zV1Hobq18X8CAAD__6yvdOs">