public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Michael Meissner <meissner@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/meissner/heads/work048)] Fix logic error in 32-bit trampolines.
Date: Thu, 15 Apr 2021 17:29:21 +0000 (GMT)	[thread overview]
Message-ID: <20210415172921.1EE9C3851C1C@sourceware.org> (raw)

https://gcc.gnu.org/g:350ab510c1444a3a95896e678c30cf461b0632a2

commit 350ab510c1444a3a95896e678c30cf461b0632a2
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Thu Apr 15 13:28:34 2021 -0400

    Fix logic error in 32-bit trampolines.
    
    The test in the PowerPC 32-bit trampoline support is backwards.  It aborts
    if the trampoline size is greater than the expected size.  It should abort
    when the trampoline size is less than the expected size.
    
    I verified this by creating a 32-bit trampoline program and manually
    changing the size of the trampoline to be 48 instead of 40.  The program
    aborted with the larger size.  I updated this code and ran the test again
    and it passed.
    
    I did a bootstrap build on a big endian power8 system that supports both
    32-bit and 64-bit executables, and there were no regressions.  Can I check
    this patch into the trunk?
    
    libgcc/
    2021-04-15  Michael Meissner  <meissner@linux.ibm.com>
    
            PR target/98952
            * config/rs6000/tramp.S (__trampoline_setup): Fix trampoline size
            comparison in 32-bit.

Diff:
---
 libgcc/config/rs6000/tramp.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libgcc/config/rs6000/tramp.S b/libgcc/config/rs6000/tramp.S
index 4236a82b402..6b61d892da6 100644
--- a/libgcc/config/rs6000/tramp.S
+++ b/libgcc/config/rs6000/tramp.S
@@ -64,8 +64,7 @@ FUNC_START(__trampoline_setup)
         mflr	r11
         addi	r7,r11,trampoline_initial-4-.LCF0 /* trampoline address -4 */
 
-	li	r8,trampoline_size	/* verify that the trampoline is big enough */
-	cmpw	cr1,r8,r4
+	cmpwi	cr1,r4,trampoline_size	/* verify that the trampoline is big enough */
 	srwi	r4,r4,2		/* # words to move */
 	addi	r9,r3,-4	/* adjust pointer for lwzu */
 	mtctr	r4


                 reply	other threads:[~2021-04-15 17:29 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=20210415172921.1EE9C3851C1C@sourceware.org \
    --to=meissner@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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).