This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Converting MSVC to intel-style gcc inline assembly
On Sat, Mar 06, 2004 at 06:58:43PM +0000, Jamie Lokier wrote:
> Andi Kleen wrote:
> > > Andi Kleen wrote:
> > >> it's not possible to clobber %ebp
> > >
> > > I seem to recall that was true even with -fno-frame-pointer: you'd get
> > > silently incorrect code, even though GCC had no special uses for %ebp
> > > in that mode.
> > >
> > > Is that still so?
> >
> > Yes. The only way to clobber ebp is to push/pop ebp manually,
> > but then you have to be careful to not get any direct stack references
> > from gcc as arguments.
>
> In -fno-frame-pointer mode, there are no direct stack references
> using %ebp... or are there?
Actually there can be e.g. if you function uses alloca() or does something
else that forces a frame pointer. But I didn't mean that.
What I meant is that when you change the stack pointer and gcc passes
in offset(%esp) for "m" then offset is not valid anymore. So you have
to be careful that this doesn't happen, e.g. by always using "r"
for anything local.
-Andi