This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Can shrink-wrapping ever move prologue past an ASM statement?
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>
- Cc: Jeff Law <law at redhat dot com>, Josh Poimboeuf <jpoimboe at redhat dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>, Vojtech Pavlik <vojtech at suse dot cz>
- Date: Fri, 10 Jul 2015 07:18:12 -0500
- Subject: Re: Can shrink-wrapping ever move prologue past an ASM statement?
- Authentication-results: sourceware.org; auth=none
- References: <20150707175349 dot GA2325 at virgil dot suse dot cz> <20150707184415 dot GB13004 at gate dot crashing dot org> <20150708092309 dot GB2325 at virgil dot suse dot cz> <20150708103631 dot GA23975 at gate dot crashing dot org> <20150708162234 dot GB4687 at treble dot redhat dot com> <20150708205111 dot GD4687 at treble dot redhat dot com> <559D92E0 dot 6030008 at redhat dot com> <559F8A0E dot 8030500 at foss dot arm dot com>
On Fri, Jul 10, 2015 at 10:02:06AM +0100, Richard Earnshaw wrote:
> This isn't going to reliably work for ARM or AArch64. If the only call
> within a leaf function is via the ASM the compiler doesn't guarantee to
> ensure the stack is aligned to the ABI requirements.
Those archs have a link register, which is clobbered by the call, so
asm doing a call should have the link register in its clobber list,
which is enough to prevent shrink-wrapping the asm. Does that also
help aligning the stack (as a side effect?)
The problem you mention is not target-specific, and would also happen
without shrink-wrapping. Maybe forcing a frame pointer (which they
do in the reported case) helps? But there certainly could exist ABIs
where it does not. This is arch-dependent code by nature, but still.
Nastiness :-)
Segher