From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3677 invoked by alias); 18 Jul 2006 15:51:17 -0000 Received: (qmail 3662 invoked by uid 22791); 18 Jul 2006 15:51:14 -0000 X-Spam-Check-By: sourceware.org Received: from cam-admin0.cambridge.arm.com (HELO cam-admin0.cambridge.arm.com) (193.131.176.58) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 18 Jul 2006 15:51:10 +0000 Received: from cam-owa1.Emea.Arm.com (cam-owa1.emea.arm.com [10.1.255.62]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id k6IFouGf008463; Tue, 18 Jul 2006 16:50:56 +0100 (BST) Received: from pc960.cambridge.arm.com ([10.1.255.211]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 18 Jul 2006 16:50:55 +0100 Subject: Re: [patch] Thumb-2 add PC misassembly From: Richard Earnshaw To: Paul Brook Cc: binutils@sourceware.org In-Reply-To: <200607130054.33837.paul@codesourcery.com> References: <200607130054.33837.paul@codesourcery.com> Content-Type: text/plain Message-Id: <1153237849.20443.45.camel@pc960.cambridge.arm.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 18 Jul 2006 15:51:00 -0000 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00234.txt.bz2 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 > > 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.