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: [patch] Thumb-2 add PC misassembly


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.


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