public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Libffi problem on darwin (MacOSX)
@ 2003-05-16 20:56 Ronald Oussoren
  2003-05-16 21:42 ` Dale Johannesen
  0 siblings, 1 reply; 8+ messages in thread
From: Ronald Oussoren @ 2003-05-16 20:56 UTC (permalink / raw)
  To: gcc

Hi,

The libffi mailing seems to be dead, hence my post here. I'm using  
libffi to interface Python and Objective-C (http://pyobjc.sf.net). This  
is working pretty well, but I'm running into a problem that seems to be  
libffi related.

We're using libffi closures in the Objective-C method tables to forward  
calls from Objective-C to python. This is working fine for basic calls,  
but gives wrong results when structs are passed. It looks like a  
mismatch between the compiler and libffi: ffi_closure_helper_DARWIN in  
libffi_darwin.c seems to assume that structs are passed "by reference"  
(line 615), while the compiler passes small structs entirely in  
registers (see assembly code emited by the following C snippet):

struct foobar {
         float a;
         int b;
};

extern struct foobar h;
extern int i;


void callee(struct foobar a1, int a2)
{
}

void caller(void)
{
         struct foobar g = { 1.0, 2.0 };
         callee(g, 42);
}


The compiler behaviour seems to be the same as prescribed by 'Mach-O  
runtime conventions on PowerPC'  
(http://developer.apple.com/techpubs/macosx/DeveloperTools/ 
MachORuntime/2rt_powerpc_abi/index.html).

I'm using Apple's version of GCC 3.1 and a libffi from the GCC  
repository (HEAD branch). I've disabled the eh_frames in darwin*.S  
(otherwise this version of libffi won't work with Apple's GCC), but  
otherwise it's the same as in CVS.

Ronald

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-05-26  5:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-16 20:56 Libffi problem on darwin (MacOSX) Ronald Oussoren
2003-05-16 21:42 ` Dale Johannesen
2003-05-17  6:03   ` Andreas Tobler
2003-05-17 10:17     ` Ronald Oussoren
2003-05-17 15:39       ` Andreas Tobler
2003-05-25 20:49         ` Ronald Oussoren
2003-05-26  5:24           ` Andreas Tobler
2003-05-26 10:01             ` Ronald Oussoren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).