This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, arm][PR88167] Fix __builtin_return_address returns invalid address
- From: Mihail Ionescu <mihail dot ionescu at foss dot arm dot com>
- To: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Earnshaw <richard dot earnshaw at arm dot com>, Kyrylo Tkachov <kyrylo dot tkachov at arm dot com>
- Date: Tue, 18 Dec 2018 09:32:13 +0000
- Subject: [PATCH, arm][PR88167] Fix __builtin_return_address returns invalid address
Hi All,
In Thumb mode when the function prologue gets expanded, in case of a
multiple register push, additional mov instructions are generated to
save the high registers which result in lr getting overwritten before
it's value can be used to retrieve the return address.
The fix consists of detecting if lr is alive after the prologue, in
which case, the lr register won't be used as a scratch.
Regression tested on arm-none-eabi.
gcc/ChangeLog:
2018-11-23 Mihail Ionescu <mihail.ionescu@arm.com>
PR target/88167
* config/arm/arm.c: Add lr liveness check.
gcc/testsuite/ChangeLog
2018-11-23 Mihail Ionescu <mihail.ionescu@arm.com>
PR target/88167
* gcc.target/arm/pr88167.c: New test.
If everything is ok for trunk, could someone commit it on my behalf?
Best regards,
Mihail