This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ARM] Allow MOV/MOV.W to accept all possible immediates
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "Jiong Wang" <jiong dot wang at foss dot arm dot com>
- Cc: "Szabolcs Nagy" <szabolcs dot nagy at arm dot com>, "Rich Felker" <dalias at libc dot org>, "Reiner Herrmann" <reiner at reiner-h dot de>, "Binutils" <binutils at sourceware dot org>
- Date: Thu, 05 Jan 2017 07:21:46 -0700
- Subject: Re: [ARM] Allow MOV/MOV.W to accept all possible immediates
- Authentication-results: sourceware.org; auth=none
- References: <27959ba0-3b6f-185d-1c8b-55a28d7e286c@foss.arm.com> <586E23CD.7030903@arm.com> <586E24A6.2020606@arm.com> <ac3ec52b-2e8a-a4f4-d144-c5d61c3de31e@foss.arm.com>
>>> On 05.01.17 at 14:59, <jiong.wang@foss.arm.com> wrote:
> On 05/01/17 10:49, Szabolcs Nagy wrote:
>> On 05/01/17 10:45, Szabolcs Nagy wrote:
>>> $ cat bug.s
>>> .syntax unified
>>> .text
>>> .arch armv7-a
>>> mov r3,#1
>>>
>>> .arch armv4t
>>> .eabi_attribute 6,2
>>> bx lr
>>>
>>> $ arm-none-linux-gnueabihf-as -mthumb bug.s
>>> bug.s: Assembler messages:
>>> bug.s:4: Error: invalid constant (1) after fixup
>>>
>>> previously this worked, but i'm not sure if the mix
>>> of .arch directives and .syntax unified is valid here.
>
> It looks to me the failure is caused by the second ".arch armv4t"
> overrides the
> first ".arch armv7-a", therefore the arch feature is lowerd to armv4t in
> assembler fixup stage. While "mov r3, #1" under thumb mode is only allowed
> with ARMv6T2.
>
> This patch tightend the check from
>
> if (fixP->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE
> || fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM)
>
> into:
>
> if ((fixP->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE
> && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2))
> || fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM)
>
>
> thus the sequences in bug.s is not allowed.
Suggests pretty clearly that the fixup should record the arch in
use at the time it is being created.
Jan