From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21671 invoked by alias); 21 Dec 2015 18:47:44 -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 21662 invoked by uid 89); 21 Dec 2015 18:47:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=bigendian, big-endian, Hx-languages-length:1201, H*Ad:U*libffi-discuss X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 21 Dec 2015 18:47:42 +0000 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Dec 2015 18:47:39 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Dec 2015 18:47:36 -0000 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: uweigand@de.ibm.com X-IBM-RcptTo: libffi-discuss@sourceware.org Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id D0274219004D for ; Mon, 21 Dec 2015 18:47:27 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBLIlagi59375826 for ; Mon, 21 Dec 2015 18:47:36 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBLHlb9w004309 for ; Mon, 21 Dec 2015 10:47:37 -0700 Received: from oc7340732750.ibm.com (icon-9-164-187-179.megacenter.de.ibm.com [9.164.187.179]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tBLHlbab004303; Mon, 21 Dec 2015 10:47:37 -0700 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 372366414; Mon, 21 Dec 2015 19:39:30 +0100 (CET) Subject: Re: s390x ffi_closure_helper_SYSV To: planrichi@gmail.com (Richard Plangger) Date: Mon, 21 Dec 2015 18:47:00 -0000 From: "Ulrich Weigand" Cc: libffi-discuss@sourceware.org In-Reply-To: <56730DB0.2080301@gmail.com> from "Richard Plangger" at Dec 17, 2015 08:32:00 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20151221183930.372366414@oc7340732750.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15122118-0013-0000-0000-00000813553D X-SW-Source: 2015/txt/msg00114.txt.bz2 Hi Richard, > thx for your reply. I agree that it makes sense to return a full ffi_arg > if the integral value is smaller than the machine register. It's not a matter of what makes sense, it's a matter of what libffi *expects the user-provided callback to do*. If the *callback* doesn't fill in a full ffi_arg, then libffi will not operate correctly. > The program pollutes a fairly large junk of memory below the frame > pointer and then calls back to a python function (from c). > Because the ret_buffer variable (in ffi_closure_helper_SYSV) is not > initialized properly, the returned value is not the same on s390x as it > is on e.g. x86. The point is that if the user-callback were to fill in a full ffi_arg, then ret_buffer would be completely filled. If ret_buffer isn't fully written, then that's a bug in the callback PyPy provides to libffi. > `make` on my laptop (x86) returns without asserting, but > it does not on s390x. PPC was recently implemented on PyPy and there we > did also not hit this issue. Is this on little-endian or big-endian PowerPC? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com