From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8707 invoked by alias); 16 May 2003 20:55:40 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 8619 invoked from network); 16 May 2003 20:55:36 -0000 Received: from unknown (HELO smtpzilla5.xs4all.nl) (194.109.127.141) by sources.redhat.com with SMTP; 16 May 2003 20:55:36 -0000 Received: from cistron.nl (gondolin.xs4all.nl [213.84.37.54]) by smtpzilla5.xs4all.nl (8.12.9/8.12.9) with ESMTP id h4GKtZHn034285 for ; Fri, 16 May 2003 22:55:35 +0200 (CEST) Date: Fri, 16 May 2003 20:56:00 -0000 Mime-Version: 1.0 (Apple Message framework v552) Content-Type: text/plain; delsp=yes; charset=US-ASCII; format=flowed Subject: Libffi problem on darwin (MacOSX) From: Ronald Oussoren To: gcc@gcc.gnu.org Content-Transfer-Encoding: 7bit Message-Id: X-SW-Source: 2003-05/txt/msg01626.txt.bz2 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