This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM long branch stub fixes


On Wed, Jun 25, 2008 at 02:48:41PM +0200, Christophe LYON wrote:
> Hi Daniel,
>
> On 25.06.2008 00:03, Daniel Jacobowitz wrote:
>> This patch corrects two bugs in ARM stubs I discovered.  One was an
>> incorrect offset (+20 instead of +16) for the v4t stubs; this caused
>> lots of arm-none-eabi/arm-sim/-mthumb tests to time out.  The other
>> was use of 'b.n .' instead of 'bx r6'; if you write 'b r6' you'll get
>> the former, and it's easy to miss that there's a relocation on the
>> instruction.
>>
>
> Thanks for catching this.
> BTW, is this 'b r6' -> 'b.n .' transformation documented somewhere?

It's just that branch does not take a register.  So r6 is a symbol
named r6 in this context, the same as 'b foo'.

b.n is a branch with 16-bit instruction; IIRC Thumb-2 has a b.w which
is a 32-bit instruction (n == narrow, w == wide).

So what you get in disassembly is a branch to the current location
plus an 11-bit relocation to the target.

> Could you remind me why you use 'addr + 1' when you add the local symbols 
> in thumb mode? (in arm_map_one_stub())

Because I generated them as STT_FUNC; the low bit marks them as Thumb,
for anything that does not read mapping symbols.  Confusingly, $t is
STT_NOTYPE with low bit clear; but a Thumb function is STT_FUNC with
low bit set.

Thanks for looking over it!

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]