[Libreoffice] Different x86 ABI on BSDs and MaxOSX

Caolán McNamara caolanm at redhat.com
Thu Dec 9 01:43:54 PST 2010


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.



More information about the LibreOffice mailing list