ARM long branch stubs: pic take 2
Richard Earnshaw
rearnsha@arm.com
Thu Feb 26 10:31:00 GMT 2009
On Wed, 2009-02-25 at 18:51 +0100, Christophe LYON wrote:
> +00001000 <_start>:
> + 1000: f000 f802 bl 1008 <__bar_from_thumb>
> + 1004: 0000 lsls r0, r0, #0
> + ...
> +
> +00001008 <__bar_from_thumb>:
> + 1008: 4778 bx pc
> + 100a: 46c0 nop \(mov r8, r8\)
> + 100c: e59fc000 ldr ip, \[pc, #0\] ; 1014
> <__bar_from_thumb\+0xc>
> + 1010: e08cf00f add pc, ip, pc
> + 1014: 02000000 .word 0x02000000
> +
> +Disassembly of section .foo:
> +
> +02001014 <bar>:
> + 2001014: e12fff1e bx lr
I think that this shows that the offset calculation is wrong: The
offset needs to be based on the location of the instruction that uses
the PC -- in this case address 0x1010, with PC=0x1018 (since it's an ARM
instruction), so 0x1018 + 0x02000000 = 0x02001018, which is the
instruction after your bx lr instruction.
R.
More information about the Binutils
mailing list