This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Assembler generated by gcc
- From: "Toon Knapen" <toon dot knapen at fft dot be>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 7 Apr 2004 14:15:51 +0200
- Subject: Assembler generated by gcc
The most simple C program
int main()
{
return 13 ;
}
Results in following with 'gcc -S <file>' (gcc version 3.2.2)
.file "tt.c"
.text
.globl main
.type main,@function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
movl $13, %eax
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 3.2.2"
I would have expected 'main' to only contain
movl $13, %eax
leave
ret
So now I wonder why all the statements before these 3 statements are in
'main'. I've searched in several assembler tutorials and manuals but did
not find an explanation.
Thanks for any tips (to some webpage or ...)
toon