ARM long branch stub: thumb

Christophe LYON christophe.lyon@st.com
Thu Feb 19 17:30:00 GMT 2009


On 19.02.2009 18:04, Paul Brook wrote:
> On Thursday 19 February 2009, Christophe LYON wrote:
>> +00001000 <__bar_veneer>:
>> +    1000:      b540            push    {r6, lr}
>> +    1002:      4e02            ldr     r6, \[pc, #8\]
>> +    1004:      46fe            mov     lr, pc
>> +    1006:      4730            bx      r6
>> +    1008:      bd40            pop     {r6, pc}
>> +    100a:      bf00            nop
> 
> Waitaminute. This code is completely bogus.
> (1) You're creating an extra stack frame. This will break any function that 
> passes args on the stack.

Indeed!
Actually, I merely tried to adapt the existing "Thumb->(non-interworking 
aware) ARM" glue. If you look at the comments just above 
arm_allocate_glue_section_space(), you'll see that the existing glue 
creates a frame... oops.

> (2) mov lr, pc doesn't set the low bit of lr, so the callee will return to the 
> stub in ARM mode.
> 
> What you need to do is:
 > [...]
Thanks, I'll update my patch.

Christophe.




More information about the Binutils mailing list