From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21440 invoked by alias); 10 Oct 2016 07:27:59 -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 21420 invoked by uid 89); 10 Oct 2016 07:27:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.4 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: dtbo.net Received: from mic92-4-82-224-21-170.fbx.proxad.net (HELO dtbo.net) (82.224.21.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Oct 2016 07:27:48 +0000 Received: by dtbo.net (Postfix, from userid 1000) id 3631B22200C; Mon, 10 Oct 2016 09:27:46 +0200 (CEST) Date: Mon, 10 Oct 2016 07:27:00 -0000 From: Damien =?iso-8859-1?Q?Th=E9bault?= To: Andrew Pinski Cc: "libffi-discuss@sourceware.org" Subject: Re: Floating-point variadic function call Message-ID: <20161010072746.GA12478@han> References: <20161010070352.GA11072@han> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016/txt/msg00044.txt.bz2 On Mon, Oct 10, 2016 at 12:17:03AM -0700, Andrew Pinski wrote: > > I tested on a x86_64 computer both 64-bit and 32-bit versions (the > > latter compiled with -m32) as well as ARM under qemu. > > In all those cases, I didn't get the proper result with floats while > > doubles are ok, as well as chars. >=20 > That is because the variadic function ABI is different from the normal > argument ABI on ARM hard-float EABI. Basically for variadic functions > float are passed via the integer registers while for normal functions, > they are passed via the vfp registers. >=20 > Basically you need to use variadic function support in libff. Use > ffi_prep_cif_var instead of ffi_prep_cif and then don't do: >=20 > for(i=3D1 ; i<10 ; i++) > { > arg_types[i] =3D &ffi_type_float; > } I'm actually using ffi_prep_cif_var() for the variadic call, but what should I put as arg_type then ? Thanks, --=20 Damien Th=E9bault