This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Calling functions on x86
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: <patriciak784-gccmainling at yahoo dot de>,<gcc at gcc dot gnu dot org>
- Date: Tue, 20 Sep 2005 12:43:02 +0100
- Subject: RE: Calling functions on x86
----Original Message----
>From: patriciak784-gccmainling
>Sent: 20 September 2005 12:15
> On x86 and GCC 3.4.2, the resulting asm code when
> leaving a stackframe is (in intel_syntax)
> mov esp,ebp
> pop ebp
> .(results in 0x89EC5D or 0x8BE55D)
> The AMD optimisation guide for AMD64 tells you not to
> use mov esp, ebp - pop ebp but to use "leave"(just
> 0xC9)!
I don't have a 64bit version, but did you try using the appropriate
-march= option?
dk@mace /test/leave> cat foo.c
int foo (void)
{
return 9;
}
dk@mace /test/leave> gcc -O0 -S foo.c -o foo.s
dk@mace /test/leave> cat foo.s
.file "foo.c"
.text
.globl _foo
.def _foo; .scl 2; .type 32; .endef
_foo:
pushl %ebp
movl %esp, %ebp
movl $9, %eax
popl %ebp
ret
dk@mace /test/leave> gcc -O0 -S -march=athlon-xp foo.c -o foo.s
dk@mace /test/leave> cat foo.s
.file "foo.c"
.text
.globl _foo
.def _foo; .scl 2; .type 32; .endef
_foo:
pushl %ebp
movl %esp, %ebp
movl $9, %eax
leave
ret
dk@mace /test/leave>
cheers,
DaveK
--
Can't think of a witty .sigline today....