Stack Boundary

Mike mgoppold5@yahoo.com
Sun Aug 18 06:57:00 GMT 2013


Using GCC 4.7.2 in MINGW.

Cannot figure out the code generated for " 
-mpreferred-stack-boundary=7".  If you understand the generated code, 
please explain.

I compiled a sample program I wrote (attached), disassembled it, and 
looked at the important instruction "sub esp,ALIGN_CONSTANT" in each of 
the functions.

With a -mpreferred-stack-boundary setting of 7, that means each function 
should be aligned to 128 bytes, or 0x80 bytes.

But these are the results of ALIGN_CONSTANT

FUNCTION,ALIGN_CONSTANT
start,0x178
sum,0x8C
m,0x178

I would think ALIGN_CONSTANT should be closer to 128 minus a small value 
for all 3 functions.  But 0x178 and 0x8c?




-------------- next part --------------
A non-text attachment was scrubbed...
Name: CallingConventions.tar.gz
Type: application/gzip
Size: 939 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20130818/d5e0471d/attachment-0001.gz>


More information about the Gcc-help mailing list