This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: stack-protection vs alloca vs dwarf2
- From: Richard Henderson <rth at redhat dot com>
- To: DJ Delorie <dj at redhat dot com>, Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 18 Apr 2014 23:35:32 -0700
- Subject: Re: stack-protection vs alloca vs dwarf2
- Authentication-results: sourceware.org; auth=none
- References: <201404170303 dot s3H335mQ015761 at greed dot delorie dot com> <2462067 dot Uq517GJRxu at polaris> <201404171714 dot s3HHEOie007702 at greed dot delorie dot com> <53521834 dot 8040808 at redhat dot com>
On 04/18/2014 11:31 PM, Richard Henderson wrote:
> On 04/17/2014 10:14 AM, DJ Delorie wrote:
>> _medium_frame:
>> pushm r6-r12
>> add #-4, r0, r6 ; marked frame-related (fp = sp - 4)
>> mov.L r6, r0 ; marked frame-related (sp = fp)
>
> There's your bug. If the frame pointer is required, you shouldn't mark that
> third insn as frame related.
>
> With this sequence, the auto-guessing code is assuming that r6 is just a
> computational temporary and that sp is still the cfa.
This auto-guessing mistake is why I strongly recommend not using it if
possible. Better to use explicit REG_CFA_DEF_CFA (et al) notes. Certainly
one *must* use the explicit notes for the epilogue.
r~