• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
MacOS X calling conventions on Intel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MacOS X calling conventions on Intel


  • Subject: MacOS X calling conventions on Intel
  • From: John Reppy <email@hidden>
  • Date: Mon, 13 Feb 2006 15:12:24 -0600

The MacOS X ABI Function Call Guide states the following about struct results:

The called function places structures and unions 8 bytes or smaller
in the EAX and EDX registers. For example, the C99 data type _Complex
float is 8 bytes in size; therefore, the called function returns results
of this type in the EAX and EDX registers.


But this specification does not seem to hold when the size of the struct is
six bytes (structs of four bytes and eight bytes are returned in registers).
For example:


<jhr@frogbat> cat x.c
typedef struct { short x; short y; short z; } Pt3_t;
Pt3_t o3 () { Pt3_t p = {0, 0, 0}; return p; }
<jhr@frogbat> gcc -S -O x.c
<jhr@frogbat> cat x.s
        .text
.globl _o3
_o3:
        pushl   ëp
        movl    %esp, ëp
        movl    8(ëp), êx
        movw    $0, 4(êx)
        movw    $0, 2(êx)
        movw    $0, (êx)
        popl    ëp
        ret     $4
        .subsections_via_symbols

Can someone from Apple comment on whether this behavior is a bug in the
documentation or a bug in gcc?  Thanks.

	- John

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: linking Universal Binary performance
  • Next by Date: Re: How are we supposed to paste text in XCode?
  • Previous by thread: Re: making iPod-compatible movies from NSImage arrays
  • Next by thread: Script step with administrative privileges
  • Index(es):
    • Date
    • Thread