public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/101324] New: powerpc64le: hashst appears before mflr at -O1 or higher
@ 2021-07-05 15:32 tuliom at ascii dot art.br
  2021-07-05 22:18 ` [Bug target/101324] " segher at gcc dot gnu.org
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: tuliom at ascii dot art.br @ 2021-07-05 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2022-02-11 22:33 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 15:32 [Bug target/101324] New: powerpc64le: hashst appears before mflr at -O1 or higher tuliom at ascii dot art.br
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

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