Hi
When I compile my program with -S option of gcc it always produces some meaningless (for me) lines! Below is what i did
Code:
fnoyan@linux:~> cat > trial.c
#include <stdio.h>
int main()
{
return 0;
}
fnoyan@linux:~> gcc -Wall trial.c -S -o trial.s
fnoyan@linux:~> cat trial.s
.file "trial.c"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $0, %eax
addl $15, %eax
addl $15, %eax
shrl $4, %eax
sall $4, %eax
subl %eax, %esp
movl $0, %eax
leave
ret
.size main, .-main
.ident "GCC: (GNU) 4.0.2 20050901 (prerelease) (SUSE Linux)"
.section .note.GNU-stack,"",@progbits
All the parts are ok except the part below
Code:
andl $-16, %esp
movl $0, %eax
addl $15, %eax
addl $15, %eax
shrl $4, %eax
sall $4, %eax
subl %eax, %esp
Even if I delete these lines and compile the corresponding assembly file (with gcc -Wall trial.s -o trial), the program runs fine! Also, after compilation, I chechked the corresponinding assembly code for the file with GDB. The compiler did not add any other line.
What is the aim of these lines? Why does it add 15 two times instead of adding 30?
Thanks...