GCC/assembly question

Diego Figueroa dfiguero@cs.yorku.ca
Thu Jun 19 14:16:00 GMT 2003


Hi,

I was wondering why in Linux (RH9 - GCC 3.2.2-5 if I have this code:

main(){}

After 'gcc -S -o ex1.s ex1.c' I get:


...

main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
        leave
        ret
...


What is the purpose of:

* subl $8, %esp

There are no variables so why is the stack making space?

* andl $-16, %esp

Is the 16-bit alignment something to do with processor performance?

* movl $0, %eax
  subl %eax, %esp

Wasting time? I know if I pass the -O flag these two will dissapear from
the code.


Are there any documents where this sort of topics are discussed?


Thanks,


Diego.



More information about the Gcc-help mailing list