From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51227 invoked by alias); 29 May 2017 07:44:08 -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 51179 invoked by uid 89); 29 May 2017 07:44:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*aph, Lead, haley, Haley X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 May 2017 07:44:05 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80A77C057FA7 for ; Mon, 29 May 2017 07:44:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 80A77C057FA7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=aph@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 80A77C057FA7 Received: from zebedee.pink (unknown [10.40.205.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB10D18346; Mon, 29 May 2017 07:44:06 +0000 (UTC) Subject: Re: Cosure return value issue on Linux PPC64 To: libffi-discuss@sourceware.org References: <53985e874a349c551e7943677d21c766@mail.kylheku.com> From: Andrew Haley Message-ID: Date: Mon, 29 May 2017 07:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <53985e874a349c551e7943677d21c766@mail.kylheku.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00010.txt.bz2 On 27/05/17 17:59, Kaz Kylheku (libffi) wrote: > > The problem is that all the big endian cases are expecting the caller to > place the return value at a displaced address. If the type is int, for > instance, the expectation is that the return value is to be stored at > *(int *)(retval + 4). If it is short, then at *(short *)(retval + 6) > and so on. > > Is this documented somewhere? > > My code is storing everything at just the retval base address, > regardless of size. On a 64-bit target, use word loads for your return values and cast them accordingly. So, don't use *(int *)(retval + 4) use (int)*retval -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671