This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Thumb-2 add PC misassembly
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 18 Jul 2006 16:50:50 +0100
- Subject: Re: [patch] Thumb-2 add PC misassembly
- References: <200607130054.33837.paul@codesourcery.com>
On Thu, 2006-07-13 at 00:54, Paul Brook wrote:
> In Thumb-2 "add reg, pc, #imm" should be assembled to the addw instruction,
> not add.w (PC is not a valid source for the latter).
> The patch below fixes this. It also uses the addw instruction in other cases
> where the immediate is not valid for a normal add.
> The same applies for sub.
>
> Tested with cross to arm-none-eabi.
>
> Ok?
>
> 2006-07-13 Paul Brook <paul@codesourcery.com>
>
> bfd/
> * bfd-in2.h: Regenerate.
> * libbfd.h: Regenerate.
> * reloc.c: Add BFD_RELOC_ARM_T32_ADD_IMM.
> gas/
> * tc-arm.c (do_t_add_sub): Use addw/subw when source is PC.
> (md_convert_frag): Use correct reloc for add_pc. Use
> BFD_RELOC_ARM_T32_ADD_IMM for normal add/sum.
> (md_apply_fix): Handle BFD_RELOC_ARM_T32_ADD_IMM.
> (arm_force_relocation): Handle BFD_RELOC_ARM_T32_ADD_IMM.
> gas/testsuite/
> * gas/arm/thumb2_add.d: New test.
> * gas/arm/thumb2_add.s: New test.
Ok,
R.