public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Meissner <meissner@linux.ibm.com>,
	gcc-patches@gcc.gnu.org, David Edelsohn <dje.gcc@gmail.com>,
	Bill Schmidt <wschmidt@linux.ibm.com>,
	Peter Bergner <bergner@linux.ibm.com>,
	Will Schmidt <will_schmidt@vnet.ibm.com>
Subject: Re: [PATCH] Fix logic error in 32-bit trampolines, PR target/98952
Date: Thu, 22 Apr 2021 17:56:32 -0500	[thread overview]
Message-ID: <20210422225632.GH27473@gate.crashing.org> (raw)
In-Reply-To: <20210409210907.GA5325@ibm-toto.the-meissners.org>

On Fri, Apr 09, 2021 at 05:09:07PM -0400, Michael Meissner wrote:
> Fix logic error in 32-bit trampolines, PR target/98952.
> 
> 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.

> 	PR target/98952
> 	* config/rs6000/tramp.S (__trampoline_setup): Fix trampoline size
> 	comparison in 32-bit.

> --- 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

As Will says, it looks like the ELFv2 version has the same bug.  Please
fix that the same way.

In the commit message and the changelog, point out that you folded the
cmp with the li while you were at it.  It is easier to read code like
this so the change is fine, but do point it out.

Can you test this in a testcase somehow?  That would have found the
ELFv2 case, for example.

Okay for trunk.  Okay for backport to 11 when that branch opens again.
Does this need more backports?  (Those should follow after 11 of
course).

Thanks,


Segher

  parent reply	other threads:[~2021-04-22 22:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 21:09 Michael Meissner
2021-04-12 22:02 ` will schmidt
2021-04-22 22:50   ` Segher Boessenkool
2021-04-19 19:54 ` Ping: " Michael Meissner
2021-04-22 22:56 ` Segher Boessenkool [this message]
2021-04-23 22:24   ` Michael Meissner
2021-04-23 23:58     ` Segher Boessenkool
2021-04-25 13:45       ` Bill Schmidt

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=20210422225632.GH27473@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=meissner@linux.ibm.com \
    --cc=will_schmidt@vnet.ibm.com \
    --cc=wschmidt@linux.ibm.com \
    /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).