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 stubs: pic take 2


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.


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