From: Alan Modra <amodra@gmail.com>
To: libffi-discuss@sourceware.org
Subject: PowerPC64 ELFv2 fix 2 of 2
Date: Wed, 20 Nov 2013 07:35:00 -0000 [thread overview]
Message-ID: <20131120073521.GG22514@bubble.grove.modra.org> (raw)
In-Reply-To: <20131119001430.GX22514@bubble.grove.modra.org>
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
next prev parent reply other threads:[~2013-11-20 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-17 3:17 Straying #endif in ppc_closure.S Alan Modra
2013-11-18 11:38 ` Anthony Green
2013-11-19 0:14 ` Alan Modra
2013-11-20 7:35 ` Alan Modra [this message]
2013-11-20 7:38 ` Tidy powerpc*-linux support Alan Modra
2014-05-30 5:10 ` Ryan Hill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131120073521.GG22514@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=libffi-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).