From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19884 invoked by alias); 29 Oct 2014 20:06:17 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 19840 invoked by uid 89); 29 Oct 2014 20:06:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f48.google.com Received: from mail-qg0-f48.google.com (HELO mail-qg0-f48.google.com) (209.85.192.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 29 Oct 2014 20:06:13 +0000 Received: by mail-qg0-f48.google.com with SMTP id q108so2923434qgd.35 for ; Wed, 29 Oct 2014 13:06:11 -0700 (PDT) X-Received: by 10.229.248.5 with SMTP id me5mr19508245qcb.2.1414613169213; Wed, 29 Oct 2014 13:06:09 -0700 (PDT) Received: from pike.twiddle.home.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id a12sm5020495qai.1.2014.10.29.13.06.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Oct 2014 13:06:08 -0700 (PDT) From: Richard Henderson To: libffi-discuss@sourceware.org Subject: [PATCH 09/10] arm: Add argument space for the hidden struct return pointer Date: Wed, 29 Oct 2014 20:06:00 -0000 Message-Id: <1414613147-10917-10-git-send-email-rth@twiddle.net> In-Reply-To: <1414613147-10917-1-git-send-email-rth@twiddle.net> References: <1414613147-10917-1-git-send-email-rth@twiddle.net> X-SW-Source: 2014/txt/msg00167.txt.bz2 This should have been failing all along, but it's only exposed by the complex_int test case. --- src/arm/ffi.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/arm/ffi.c b/src/arm/ffi.c index 9a11e8f..eabab47 100644 --- a/src/arm/ffi.c +++ b/src/arm/ffi.c @@ -202,17 +202,7 @@ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { int flags = 0, cabi = cif->abi; - size_t bytes; - - /* Round the stack up to a multiple of 8 bytes. This isn't needed - everywhere, but it is on some platforms, and it doesn't harm anything - when it isn't needed. */ - bytes = ALIGN (cif->bytes, 8); - - /* Minimum stack space is the 4 register arguments that we pop. */ - if (bytes < 4*4) - bytes = 4*4; - cif->bytes = bytes; + size_t bytes = cif->bytes; /* Map out the register placements of VFP register args. The VFP hard-float calling conventions are slightly more sophisticated @@ -270,12 +260,29 @@ ffi_prep_cif_machdep (ffi_cif *cif) A Composite Type larger than 4 bytes, or whose size cannot be determined statically ... is stored in memory at an address passed [in r0]. */ - flags = (cif->rtype->size <= 4 ? ARM_TYPE_INT : ARM_TYPE_STRUCT); + if (cif->rtype->size <= 4) + flags = ARM_TYPE_INT; + else + { + flags = ARM_TYPE_STRUCT; + bytes += 4; + } break; default: abort(); } + + /* Round the stack up to a multiple of 8 bytes. This isn't needed + everywhere, but it is on some platforms, and it doesn't harm anything + when it isn't needed. */ + bytes = ALIGN (bytes, 8); + + /* Minimum stack space is the 4 register arguments that we pop. */ + if (bytes < 4*4) + bytes = 4*4; + + cif->bytes = bytes; cif->flags = flags; return FFI_OK; -- 1.9.3