Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


On Thu, 2010-12-09 at 01:42 +0100, Jan Holesovsky wrote:
http://agner.org./optimize/calling_conventions.pdf

and from what I see on page 19, it seems to me that *BSD defaults to the
'fastcall' variant, right?  

We're looking at "Table 7. Methods for returning structure, class and
union objects" right ? 

The table suggests that the small structs that combine int and float
are returned on stack

Are you looking at "Table 6. Methods for passing structure..." ? I'm
only looking at structure *returns*.

calling_conventions.pdf baffles me a little in Table 7 anyway. System V
Application Binary Interface (abi386-4.pdf) clearly says "If a function
returns a structure or union, then the caller provides space for the
return value and places its address on the stack as argument word zero",
i.e. default Linux ABI x86 does not return structs in registers, despite
the "I" in "simple structure, class or union" for "Gnu except Mac OS"
where I is "Returned in integer registers". We clearly don't don't
return small structs in regs on x86 Linux so I don't know what "Gnu
except Mac OS" refers to there.

Anyway, better info where Apple documents the diff they use on MacOSX
from the classic SYSV ABI.

http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html#//apple_ref/doc/uid/TP40002492-SW4

Structures. The called function returns structures according to their
aligned size.
 Structures 1 or 2 bytes in size are placed in EAX.
 Structures 4 or 8 bytes in size are placed in: EAX and EDX

Anyway, what I'll simply do is first add some tests to testtools for
returning something comprised of two floats, and or something comprised
of an integer + float and for something that is 3 bytes in size, etc to
force clarification in practice.

C.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.