I've noticed some oddities (well, my program crashes) compiling code using the -mabi option of gcc 4.6. Here's a test case: int z(int i) { return i; } If I compile it with: gcc-4.6 -Os -m32 -mabi=sysv -o test.s -c test.c -S -fomit-frame-pointer I get this (trimmed): movl 4(%esp), %eax ret However, if I compile it with this: gcc-4.6 -Os -m32 -mabi=ms -o test.s -c test.c -S -fomit-frame-pointer I get this: movl 36(%esp), %eax ret The -fomit-frame-pointer is there purely to make the output assembly smaller; removing it has no effect. Compiling for amd64 with abi=ms shows the same unusually large offsets, although as amd64 passes some parameters in registers I need to change the test case for this. By comparison, compiling the same test case using a copy of the mingw compiler (based on gcc 4.4.4) produces an offset of 4. Visual C (which I assume that -mabi=ms is supposed to interoperate with) does the same. Any ideas as to what's going on here? This is all using the version of gcc 4.6.3 that comes with Debian (billed as Debian 4.6.3-1); it's hosted on an amd64 Debian box. -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ "Parents let children ride bicycles on the street. But parents do not │ allow children to hear vulgar words. Therefore we can deduce that │ cursing is more dangerous than being hit by a car." --- Scott Adams
Attachment:
signature.asc
Description: OpenPGP digital signature