[PATCH, GCC/ARM] Fix PR77904: callee-saved register trashed when clobbering sp

Thomas Preudhomme thomas.preudhomme@foss.arm.com
Thu Nov 17 08:56:00 GMT 2016


On 16/11/16 10:30, Kyrill Tkachov wrote:
> Hi Thomas,
>
> On 03/11/16 16:52, Thomas Preudhomme wrote:
>> Hi,
>>
>> When using a callee-saved register to save the frame pointer the Thumb-1
>> prologue fails to save the callee-saved register before that. For ARM and
>> Thumb-2 targets the frame pointer is handled as a special case but nothing is
>> done for Thumb-1 targets. This patch adds the same logic for Thumb-1 targets.
>>
>> ChangeLog entries are as follow:
>>
>> *** gcc/ChangeLog ***
>>
>> 2016-11-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>         PR target/77904
>>         * config/arm/arm.c (thumb1_compute_save_reg_mask): mark frame pointer
>>         in save register mask if it is needed.
>>
>
> s/mark/Mark/
>
>>
>> *** gcc/testsuite/ChangeLog ***
>>
>> 2016-11-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>>
>>         PR target/77904
>>         * gcc.target/arm/pr77904.c: New test.
>>
>>
>> Testing: Testsuite shows no regression when run with arm-none-eabi GCC
>> cross-compiler for Cortex-M0 target.
>>
>> Is this ok for trunk?
>>
>
> I'd ask for a bootstrap, but this code is Thumb-1 only so it wouldn't affect
> anything.

I can bootstrap for armv4t with --with-mode=thumb which would at least exercise 
the path. I'll try such a bootstrap on qemu.

> Can you just double-check that the new test passes on non-Thumb-1 configurations
> as well?

It works well for ARMv7-A in ARM and Thumb mode.

Best regards,

Thomas



More information about the Gcc-patches mailing list