public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tuliom at ascii dot art.br" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/101324] New: powerpc64le: hashst appears before mflr at -O1 or higher
Date: Mon, 05 Jul 2021 15:32:31 +0000	[thread overview]
Message-ID: <bug-101324-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101324

            Bug ID: 101324
           Summary: powerpc64le: hashst appears before mflr at -O1 or
                    higher
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tuliom at ascii dot art.br
  Target Milestone: ---

Created attachment 51105
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51105&action=edit
__memmove_ppc extracted from glibc

When using ROP (-mrop-protect), it's expected that generated code reads the
value from LR (mflr) and hash it later (hashst).

This works well at -O0.
However, at -O1 and higher, we're seeing cases where hashst appears before
mflr.

I'm attaching an example extracted from glibc.

You can reproduce the issue with command:
gcc -S -O1 -mrop-protect -mcpu=power10 memmove-ppc64.i -o -


The generated asm contains the following:

__memmove_ppc:
.LFB6:
        .cfi_startproc
        .localentry     __memmove_ppc,1
        hashst 0,-40(1)
        std 28,-32(1)
        stdu 1,-80(1)
        .cfi_def_cfa_offset 80
        .cfi_offset 28, -32
        mr 28,3
        subf 9,4,3
        cmpld 0,9,5
        bge 0,.L17
        std 31,72(1)
        .cfi_offset 31, -8
        add 4,4,5
        add 31,3,5
        cmpldi 0,5,15
        ble 0,.L4
        mflr 0
...

             reply	other threads:[~2021-07-05 15:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 15:32 tuliom at ascii dot art.br [this message]
2021-07-05 22:18 ` [Bug target/101324] " segher at gcc dot gnu.org
2021-07-05 23:54 ` segher at gcc dot gnu.org
2021-07-06 13:28 ` segher at gcc dot gnu.org
2021-07-06 13:46 ` tuliom at ascii dot art.br
2021-07-12  3:41 ` marxin at gcc dot gnu.org
2021-08-12 16:17 ` marxin at gcc dot gnu.org
2021-08-16 11:37 ` marxin at gcc dot gnu.org
2021-10-25 16:54 ` marxin at gcc dot gnu.org
2021-10-25 20:48 ` bergner at gcc dot gnu.org
2021-10-25 20:49 ` bergner at gcc dot gnu.org
2021-10-26  6:02 ` marxin at gcc dot gnu.org
2021-10-26  6:26 ` marxin at gcc dot gnu.org
2021-10-26 11:35 ` bergner at gcc dot gnu.org
2021-10-26 11:42 ` bergner at gcc dot gnu.org
2021-10-26 14:43 ` marxin at gcc dot gnu.org
2021-10-26 15:32 ` bergner at gcc dot gnu.org
2021-10-26 16:55 ` segher at gcc dot gnu.org
2021-10-26 19:08 ` bergner at gcc dot gnu.org
2021-10-27 20:08 ` bergner at gcc dot gnu.org
2021-10-27 20:09 ` bergner at gcc dot gnu.org
2021-10-28  3:19 ` bergner at gcc dot gnu.org
2021-12-03 20:32 ` cvs-commit at gcc dot gnu.org
2021-12-03 20:43 ` bergner at gcc dot gnu.org
2021-12-03 21:29 ` bergner at gcc dot gnu.org
2021-12-03 22:36 ` bergner at gcc dot gnu.org
2021-12-27 13:50 ` raoni at linux dot ibm.com
2022-02-11 19:28 ` cvs-commit at gcc dot gnu.org
2022-02-11 22:33 ` bergner at gcc dot gnu.org
2024-06-18 23:07 ` bergner at gcc dot gnu.org

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=bug-101324-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).