Hello,

I was working with Linux Assembly programs. The assembly code which I write and the one generated by GCC from a similar C code, varies substantially, essentially when dealing with the function calls and the stack manipulation. One thing I never could understand is that in a function, GCC always reduces it's stack by 8 bytes - unnecessarily. This has got nothing to do with the local variables in the function. I read somewhere that GCC adds extra space in the stack, but I forgot to read the reason. Sometimes it decrements another 12 bytes, without any purpose and occation, pretending to have some. I monitored these vaccuum spaces (the extra space allocated by GCC) throughout the scope of the function, and couldn't see anything - meaning these areas are not used at all, apparently mere waste of space. At the end of the function, everything came back to the normal, and 'ebp' and 'esp' are reverted back for the caller function. This looks magical, and looking at this numbers for hours makes me bug-eyed. Can anybody suggestsomething to reason this algorithm? A bottom leaf function (whence there are no more calls) the concept is cool and well understood.

Thanks in advance,
Gireesh P.

PS1: Please post your answers to <gireeshpunam@hotmail.com> also.
PS2: I don't know whether this is the best site to post a query of this kind. But I couln't find one best suited for Assembly programming.