<div dir="ltr"><div>Dear Mr. Northover,</div><div><br></div><div>Thank you for the quick reply. You are correct about the address-mode operands :) . I guess an important detail left out was that the basic block (call it A) that wants to calculate the address of the target stationary trampoline basic block (call it B) will be moved around in memory during run-time. Our earlier solution, before the feature was implemented to move around (A) is exactly as you explained using the following with a scratch reg:</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
$ bin/llc -relocation-model=pic simple.ll -o -<br>
[...]<br>
        leaq    .Ltmp0(%rip), %rax<br>
        movq    %rax, (%rdi)<br></blockquote><div><br></div><div></div><div>We now run into the problem that with this feature enabled, if we try to perform LEA backwards to the trampoline,
 after A has been moved the %rip relative offset that was put in by LLVM
 is no longer valid. Also if we perform LEA forwards to the target address in A 
that trampoline B is supposed to trampoline us too, that address will 
also be invalidated once A has been moved. Thus calculating forwards is most likely impossible. This leaves calculating LEA backwards to the trampoline BB (B) since we know that the trampoline BB will remain stationary throughout execution. That is why I would "like" to somehow store (B)'s address.<br></div><div><br></div><div>I am looking for a work around to accommodate this feature. I have never attempted to make my own section/symbols using LLVM, but I assume this is the route I should take? Pairing each trampoline BB to a symbol should make it visible and this MOVQ instruction I want possible?<br></div><div>With that approach, my questions are:</div><div>Do I need to make these symbols for the trampoline BBs as an IR opt pass, can I get away with it using a MachineModule Pass to add the trampolines per module (file) (so far I have only created BasicBlock, MachineBasicBlock, and MachineFunction passes)??</div><div>Do I need to make a separate custom section for these trampolines symbols, or can I just add them to the .text section?</div><div><br></div><div>Thanks again for your reply.<br></div><div>Sincerely,</div><div><br></div><div>K Jelesnianski<br></div></div></div>