public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: libffi-discuss@sourceware.org
Subject: PowerPC64 ELFv2 fix 1 of 2
Date: Wed, 20 Nov 2013 07:33:00 -0000	[thread overview]
Message-ID: <20131120073332.GF22514@bubble.grove.modra.org> (raw)

Using the return value area as a place to pass parameters wasn't such
a good idea, causing a failure of cls_ulonglong.c.  I didn't see this
when running the mainline gcc libffi testsuite because that version of
the test is inferior to the upstreamm libffi test.

	* src/powerpc/linux64_closure.S: Don't use the return value area
	as a parameter save area on ELFv2.

diff --git a/src/powerpc/linux64_closure.S b/src/powerpc/linux64_closure.S
index 9b6b5f3..4d012cc 100644
--- a/src/powerpc/linux64_closure.S
+++ b/src/powerpc/linux64_closure.S
@@ -60,13 +60,11 @@ ffi_closure_LINUX64:
 # endif
 
 # if _CALL_ELF == 2
-#  32 byte special reg save area + 64 byte parm save area and retval
-#  + 13*8 fpr save area + round to 16
-#  define STACKFRAME 208
+#  32 byte special reg save area + 64 byte parm save area
+#  + 64 byte retval area + 13*8 fpr save area + round to 16
+#  define STACKFRAME 272
 #  define PARMSAVE 32
-#  No parameter save area is needed for the call to ffi_closure_helper_LINUX64,
-#  so return value can start there.
-#  define RETVAL PARMSAVE
+#  define RETVAL PARMSAVE+64
 # else
 #  48 bytes special reg save area + 64 bytes parm save area
 #  + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
@@ -85,8 +83,8 @@ ffi_closure_LINUX64:
 	bt	7, .Lparmsave
 	# Our caller has not allocated a parameter save area.
 	# We need to allocate one here and use it to pass gprs to
-	# ffi_closure_helper_LINUX64.  The return value area will do.
-	addi	%r12, %r1, -STACKFRAME+RETVAL
+	# ffi_closure_helper_LINUX64.
+	addi	%r12, %r1, -STACKFRAME+PARMSAVE
 .Lparmsave:
 	std	%r0, 16(%r1)
 	# Save general regs into parm save area

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2013-11-20  7:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20131120073332.GF22514@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).