<div dir="ltr">Not exactly fall through :-)  It has to form the address of the other entry point (+1 for Thumb) in a temp register and then BX to it. It just means the constant added to the PC is very small...<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 22, 2016 at 12:06 PM, Peter Smith 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">Thank you both for the feedback.<br>
<br>
I think that there will be a good deal of commonality between<br>
architectures that need thunks. I agree that it will be easier to<br>
generalise later when we need to.<br>
<br>
ARM also has an optimisation of a thunk at the start of the section.<br>
In effect change state and fall through to a function at the start of<br>
the section. It is also quite a bit down the priority list.<br>
<span class="HOEnZb"><font color="#888888"><br>
Peter<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 22 June 2016 at 06:40, Simon Atanasyan <<a href="mailto:simon@atanasyan.com">simon@atanasyan.com</a>> wrote:<br>
> First of all thanks for finding the bug.<br>
><br>
> I agree with Rui that right now we can manage without general thunk<br>
> infrastructure. Let's provide at least a few "thunk" implementation<br>
> and after that reconsider necessity of common thunk framework. As to<br>
> MIPS there is one more type of thunk (keyword is .MIPS.stubs) and one<br>
> more optimization of current thunk (putting a thunk in the beginning<br>
> of the section if the section contains the only function required the<br>
> thunk). But I do not plan to implement these features in the near<br>
> future.<br>
><br>
> On Wed, Jun 22, 2016 at 5:29 AM, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
>> The first think I'd want to say is to not try too hard to use the existing<br>
>> "framework" in LLD. The current thunk mechanism was made just for MIPS<br>
>> non-PIC/PIC function calls and are not proven to be generic or useful for<br>
>> other purposes. We are cool with that because it just works for MIPS (except<br>
>> the bug you found) and satisfies our needs. And the amount of code for MIPS<br>
>> thunk is so small that we are not serious about reusing it. Probably the<br>
>> name given to it ("thunk") is too generic -- maybe we should rename it<br>
>> MipsLA25Thunk or something like that. I think you want to create a new type<br>
>> of thunk for ARM.<br>
>><br>
>> The bug that we sometimes create broken MIPS thunks seems to have introduced<br>
>> in r265673 which Rafael made. Before that patch, we didn't assume that<br>
>> section VAs are available in scanRelocs. I think we want to revert that<br>
>> change (although it cannot simply be reverted because the patch was<br>
>> submitted in April, and many changes has been made on it since then.)<br>
>><br>
>> Rafael, can you take at that change?<br>
>><br>
>> On Tue, Jun 21, 2016 at 9:38 PM, Peter Smith <<a href="mailto:peter.smith@linaro.org">peter.smith@linaro.org</a>> wrote:<br>
>>><br>
>>> I've been working on supporting ARM/Thumb interworking thunks in LLD<br>
>>> and have encountered a limitation that I think it is worth bringing up<br>
>>> in a wider context. This is all LLD specific, apologies if I've abused<br>
>>> llvm-dev here.<br>
>>><br>
>>> TL;DR summary:<br>
>>> - Thunks in lld may not work if they are added to InputSections that<br>
>>> have already been scanned.<br>
>>> - There is a short term fix, but in the longer term I think that we<br>
>>> will want to allow multiple passes of the relocations.<br>
>>> - I'd like to know if there are any preferences on a solution.<br>
><br>
> --<br>
> Simon Atanasyan<br>
_______________________________________________<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/mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>