[patch] Thumb-2 add PC misassembly

Richard Earnshaw rearnsha@arm.com
Tue Jul 18 15:51:00 GMT 2006


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.



More information about the Binutils mailing list