From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3429 invoked by alias); 20 Nov 2013 07:35:35 -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 3417 invoked by uid 89); 20 Nov 2013 07:35:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RDNS_NONE,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pd0-f173.google.com Received: from Unknown (HELO mail-pd0-f173.google.com) (209.85.192.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 20 Nov 2013 07:35:34 +0000 Received: by mail-pd0-f173.google.com with SMTP id p10so1622776pdj.18 for ; Tue, 19 Nov 2013 23:35:26 -0800 (PST) X-Received: by 10.68.190.103 with SMTP id gp7mr22754021pbc.74.1384932926198; Tue, 19 Nov 2013 23:35:26 -0800 (PST) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id wd6sm40451198pab.3.2013.11.19.23.35.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 23:35:25 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 5E40DEA006D; Wed, 20 Nov 2013 18:05:21 +1030 (CST) Date: Wed, 20 Nov 2013 07:35:00 -0000 From: Alan Modra To: libffi-discuss@sourceware.org Subject: PowerPC64 ELFv2 fix 2 of 2 Message-ID: <20131120073521.GG22514@bubble.grove.modra.org> References: <20131117031650.GR22514@bubble.grove.modra.org> <87eh6e2b4o.fsf@redhat.com> <20131119001430.GX22514@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131119001430.GX22514@bubble.grove.modra.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013/txt/msg00217.txt.bz2 Using NUM_FPR_ARG_REGISTERS rather than NUM_FPR_ARG_REGISTERS64 meant that a parameter save area could be allocated before it was strictly necessary. Wrong but harmless. Found when splitting apart ffi.c into 32-bit and 64-bit support. * src/powerpc/ffi.c (ffi_prep_cif_machdep_core): Use NUM_FPR_ARG_REGISTERS64 and NUM_GPR_ARG_REGISTERS64 not their 32-bit versions for 64-bit code. diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c index feb2144..6896065 100644 --- a/src/powerpc/ffi.c +++ b/src/powerpc/ffi.c @@ -978,7 +978,7 @@ ffi_prep_cif_machdep_core (ffi_cif *cif) case FFI_TYPE_LONGDOUBLE: fparg_count += 2; intarg_count += 2; - if (fparg_count > NUM_FPR_ARG_REGISTERS) + if (fparg_count > NUM_FPR_ARG_REGISTERS64) flags |= FLAG_ARG_NEEDS_PSAVE; break; #endif @@ -986,7 +986,7 @@ ffi_prep_cif_machdep_core (ffi_cif *cif) case FFI_TYPE_DOUBLE: fparg_count++; intarg_count++; - if (fparg_count > NUM_FPR_ARG_REGISTERS) + if (fparg_count > NUM_FPR_ARG_REGISTERS64) flags |= FLAG_ARG_NEEDS_PSAVE; break; @@ -1007,12 +1007,12 @@ ffi_prep_cif_machdep_core (ffi_cif *cif) if (elt) { fparg_count += elnum; - if (fparg_count > NUM_FPR_ARG_REGISTERS) + if (fparg_count > NUM_FPR_ARG_REGISTERS64) flags |= FLAG_ARG_NEEDS_PSAVE; } else { - if (intarg_count > NUM_GPR_ARG_REGISTERS) + if (intarg_count > NUM_GPR_ARG_REGISTERS64) flags |= FLAG_ARG_NEEDS_PSAVE; } break; @@ -1030,7 +1030,7 @@ ffi_prep_cif_machdep_core (ffi_cif *cif) /* Everything else is passed as a 8-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; - if (intarg_count > NUM_GPR_ARG_REGISTERS) + if (intarg_count > NUM_GPR_ARG_REGISTERS64) flags |= FLAG_ARG_NEEDS_PSAVE; break; default: -- Alan Modra Australia Development Lab, IBM