ARM long branch stubs: pic take 2
Richard Earnshaw
rearnsha@arm.com
Wed Feb 25 17:33:00 GMT 2009
On Wed, 2009-02-25 at 16:21 +0100, Christophe LYON wrote:
> +/* V4T Thumb -> ARM long branch stub, PIC. */
> +static const insn_sequence elf32_arm_stub_long_branch_v4t_thumb_arm_pic[] =
> + {
> + THUMB16_INSN(0x4778), /* bx pc */
> + THUMB16_INSN(0x46c0), /* nop */
> + ARM_INSN(0xe59fc004), /* ldr ip, [pc, #4] */
> + ARM_INSN(0xe08cc00f), /* add ip, ip, pc */
> + ARM_INSN(0xe1a0f00c), /* mov pc, ip */
> + DATA_WORD(0, R_ARM_REL32, 0), /* dcd R_ARM_REL32(X) */
> + };
We can do slightly better than that:
.thumb
bx pc
nop
.arm
ldr ip, [pc, #0]
add pc, pc, ip
dcd R_ARM_REL32(X)
Which is OK because we know the target address is ARM.
R.
More information about the Binutils
mailing list