[Patch, ARM] Relax the restrictions on REG_SP under Thumb mode on ARMv8-A

Jiong Wang jiong.wang@foss.arm.com
Tue Jul 11 12:38:00 GMT 2017



On 11/07/17 10:14, Ramana Radhakrishnan wrote:
> On Fri, May 26, 2017 at 2:34 PM, Jiong Wang <jiong.wang@foss.arm.com> wrote:
>> Hi,
>>
>>    For Thumb mode, since ARMv8-A, REG_SP is allowed in most of the places in
>> Rd/Rt/Rt2 etc while it was disallowed before ARMv8-A, and was rejected
>> through
>> the "reject_bad_reg" macro and several scattered checks.
>>
>>    This patch only rejects REG_SP in "reject_bad_reg" and several related
>> places
>> for legacy architectures before ARMv8-A. I have checked those affected
>> instructions
>> , all of them qualify such relaxations.
>>
>>    Testcases adjusted accordingly.
>>      * ld-sp-warn.d was written without .arch and without -march options
>> passed.
>>        By default it assumes all architectures, so I deleted the REG_SP
>> warning
>>        on ldrsb as it's supported on ARMv8-A.  There are actually quite a few
>>        seperate tests on other architectures, for example ld-sp-warn-v7.l
>> etc.,
>>        so there the test for ldrsb on legacy architectures are still covered.
>>      * sp-pc-validations-bad-t has been extended to armv8-a.
>>      * strex-bad-t.d restricted on armv7-a.
>>      * Some new tests for REG_SP used as Rd/Rt etc added in
>> sp-usage-thumb2-relax*.
>>
>>    OK for master?
>>
> Since this affects release branches and I've got an internal user
> complaining about this - can we backport this to the binutils 2.28 and
> binutils 2.29 branches ?

It's in 2.29 already, and it applies cleanly on 2.28 branch and passed GAS
regression test.

This patch relaxes one restriction on REG_SP.  That restriction is valid
before ARMv8-A, but has been removed since ARMv8-A on ARM32.  GAS support
had missed this.  I think there is no risk to backport this bug fix.

I will wait Tristan's approval.

>
> Ramana
>
>>    Thanks.
>>
>> gas/
>> 2017-05-25  Jiong Wang  <jiong.wang@arm.com>
>>
>>          * config/tc-arm.c (reject_bad_reg): Allow REG_SP on ARMv8-A.
>>          (parse_operands): Allow REG_SP for OP_oRRnpcsp and OP_RRnpcsp on
>>          ARMv8-A.
>>          (do_co_reg): Allow REG_SP for Rd on ARMv8-A.
>>          (do_t_add_sub): Likewise.
>>          (do_t_mov_cmp): Likewise.
>>          (do_t_tb): Likewise.
>>          * testsuite/gas/arm/ld-sp-warn.l: Delete the warning on REG_SP as Rt
>> for
>>          ldrsb.
>>          * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d: New test.
>>          * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: New test.
>>          * testsuite/gas/arm/sp-pc-validations-bad-t.d: Specifies
>> -march=armv7-a.
>>          * testsuite/gas/arm/sp-pc-validations-bad-t.s: Remove ".arch
>> armv7-a".
>>          * testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d: New test.
>>          * testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l: New test.
>>          * testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d: New test.
>>          * testsuite/gas/arm/sp-usage-thumb2-relax.s: New test.
>>          * testsuite/gas/arm/strex-bad-t.d: Specifies -march=armv7-a.
>>



More information about the Binutils mailing list