public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105649] New: Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1
@ 2022-05-18 19:56 giuliano.belinassi at gmail dot com
  2022-05-19  6:13 ` [Bug target/105649] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: giuliano.belinassi at gmail dot com @ 2022-05-18 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105649
           Summary: Wrong .localentry address on powerpc64le with
                    -fpatchable-function-entry=1
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: giuliano.belinassi at gmail dot com
  Target Milestone: ---

(this bug triggered PR105647)

With the following input file:
```
struct WinsockInterfaceClass
{
    WinsockInterfaceClass(void);


    virtual int Get_Protocol(void)
    {
        return 0;
    };
};

WinsockInterfaceClass::WinsockInterfaceClass(void)
{
}
```
Saved as test.C, compiling with

> powerpc64le-suse-linux-gcc-11 -c -fpatchable-function-entry=1 test.C

Results in the following error:
```
/tmp/cczW6LfZ.s: Assembler messages:
/tmp/cczW6LfZ.s:56: Error: .localentry expression for
`_ZN21WinsockInterfaceClassC2Ev' is not a valid power of 2
```

The reason for that maybe is because the addition of nops cause the address of
.localentry to be shifted according to how many nops inserted.

OTOH

> powerpc64le-suse-linux-gcc-11 -c -fpatchable-function-entry=2 test.C

works.

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

* [Bug target/105649] Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1
  2022-05-18 19:56 [Bug target/105649] New: Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1 giuliano.belinassi at gmail dot com
@ 2022-05-19  6:13 ` rguenth at gcc dot gnu.org
  2022-05-19 13:23 ` giuliano.belinassi at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-19  6:13 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-19
     Ever confirmed|0                           |1
             Target|                            |powerpc64le
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  That means that jumps to localentry will not be patchable.

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

* [Bug target/105649] Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1
  2022-05-18 19:56 [Bug target/105649] New: Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1 giuliano.belinassi at gmail dot com
  2022-05-19  6:13 ` [Bug target/105649] " rguenth at gcc dot gnu.org
@ 2022-05-19 13:23 ` giuliano.belinassi at gmail dot com
  2022-09-30 12:18 ` cvs-commit at gcc dot gnu.org
  2022-09-30 12:34 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: giuliano.belinassi at gmail dot com @ 2022-05-19 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Giuliano Belinassi <giuliano.belinassi at gmail dot com> ---
This issue is related to PR98125.

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

* [Bug target/105649] Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1
  2022-05-18 19:56 [Bug target/105649] New: Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1 giuliano.belinassi at gmail dot com
  2022-05-19  6:13 ` [Bug target/105649] " rguenth at gcc dot gnu.org
  2022-05-19 13:23 ` giuliano.belinassi at gmail dot com
@ 2022-09-30 12:18 ` cvs-commit at gcc dot gnu.org
  2022-09-30 12:34 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-30 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:c23b5006d3ffeda1a9edf5fd817765a6da3696ca

commit r13-2984-gc23b5006d3ffeda1a9edf5fd817765a6da3696ca
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Fri Sep 30 07:16:49 2022 -0500

    rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]

    As PR99888 and its related show, the current support for
    -fpatchable-function-entry on powerpc ELFv2 doesn't work
    well with global entry existence.  For example, with one
    command line option -fpatchable-function-entry=3,2, it got
    below w/o this patch:

      .LPFE1:
              nop
              nop
              .type   foo, @function
      foo:
              nop
      .LFB0:
              .cfi_startproc
      .LCF0:
      0:      addis 2,12,.TOC.-.LCF0@ha
              addi 2,2,.TOC.-.LCF0@l
              .localentry     foo,.-foo

    , the assembly is unexpected since the patched nops have
    no effects when being entered from local entry.

    This patch is to update the nops patched before and after
    local entry, it looks like:

              .type   foo, @function
      foo:
      .LFB0:
              .cfi_startproc
      .LCF0:
      0:      addis 2,12,.TOC.-.LCF0@ha
              addi 2,2,.TOC.-.LCF0@l
              nop
              nop
              .localentry     foo,.-foo
              nop

            PR target/99888
            PR target/105649

    gcc/ChangeLog:

            * doc/invoke.texi (option -fpatchable-function-entry): Adjust the
            documentation for PowerPC ELFv2 ABI dual entry points.
            * config/rs6000/rs6000-internal.h
            (rs6000_print_patchable_function_entry): New function declaration.
            * config/rs6000/rs6000-logue.cc (rs6000_output_function_prologue):
            Support patchable-function-entry by emitting nops before and after
            local entry for the function that needs global entry.
            * config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry):
Skip
            the function that needs global entry till global entry has been
            emitted.
            * config/rs6000/rs6000.h (struct machine_function): New bool member
            global_entry_emitted.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr99888-1.c: New test.
            * gcc.target/powerpc/pr99888-2.c: New test.
            * gcc.target/powerpc/pr99888-3.c: New test.
            * gcc.target/powerpc/pr99888-4.c: New test.
            * gcc.target/powerpc/pr99888-5.c: New test.
            * gcc.target/powerpc/pr99888-6.c: New test.
            * c-c++-common/patchable_function_entry-default.c: Adjust for
            powerpc_elfv2 to avoid compilation error.

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

* [Bug target/105649] Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1
  2022-05-18 19:56 [Bug target/105649] New: Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1 giuliano.belinassi at gmail dot com
                   ` (2 preceding siblings ...)
  2022-09-30 12:18 ` cvs-commit at gcc dot gnu.org
@ 2022-09-30 12:34 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-09-30 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |linkw at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
r13-2984 makes gcc emit error for -fpatchable-function-entry=1 on ppc64le if
the relavant function needs dual entry, I think we can close this one.

*** This bug has been marked as a duplicate of bug 99888 ***

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

end of thread, other threads:[~2022-09-30 12:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 19:56 [Bug target/105649] New: Wrong .localentry address on powerpc64le with -fpatchable-function-entry=1 giuliano.belinassi at gmail dot com
2022-05-19  6:13 ` [Bug target/105649] " rguenth at gcc dot gnu.org
2022-05-19 13:23 ` giuliano.belinassi at gmail dot com
2022-09-30 12:18 ` cvs-commit at gcc dot gnu.org
2022-09-30 12:34 ` linkw 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).