public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: libffi-discuss@sourceware.org
Subject: Re: Support PowerPC64 ELFv2 ABI
Date: Thu, 14 Nov 2013 01:41:00 -0000	[thread overview]
Message-ID: <20131114014120.GG20756@bubble.grove.modra.org> (raw)
In-Reply-To: <20131113152512.GF20756@bubble.grove.modra.org>

On Thu, Nov 14, 2013 at 01:55:12AM +1030, Alan Modra wrote:
> Finally, this adds _CALL_ELF == 2 support.  ELFv1 objects can't be
> linked with ELFv2 objects, so this is one case where preprocessor
> tests in ffi.c are fine.  Also, there is no need to define a new
> FFI_ELFv2 or somesuch value in enum ffi_abi.  FFI_LINUX64 will happily
> serve both ABIs.

Oops.  This one contained an error introduced by last minute changes,
and I didn't wait for my le bootstrap to finish last night before
posting..

	* src/powerpc/ffi.c (ffi_prep_cif_machdep_core): Use #if _CALL_ELF
	test to select parameter save sizing for ELFv2 vs. ELFv1.

diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c
index 69356a2..feb2144 100644
--- a/src/powerpc/ffi.c
+++ b/src/powerpc/ffi.c
@@ -1072,13 +1072,13 @@ ffi_prep_cif_machdep_core (ffi_cif *cif)
 #endif
 
       /* Stack space.  */
-      if (cif->abi == FFI_LINUX64)
-	{
-	  if (intarg_count > NUM_GPR_ARG_REGISTERS64)
-	    bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
-	}
-      else if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0)
+#if _CALL_ELF == 2
+      if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0)
 	bytes += intarg_count * sizeof (long);
+#else
+      if (intarg_count > NUM_GPR_ARG_REGISTERS64)
+	bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
+#endif
     }
 
   /* The stack space allocated needs to be a multiple of 16 bytes.  */

-- 
Alan Modra
Australia Development Lab, IBM

      reply	other threads:[~2013-11-14  1:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13 15:25 Alan Modra
2013-11-14  1:41 ` Alan Modra [this message]

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=20131114014120.GG20756@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).